aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar/zip_main.cc
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2015-05-29 12:27:25 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-06-01 15:46:58 +0000
commita1c73f9e7c571da6db6fc14ea63ce0b50d36a3cb (patch)
treea9ef78428c353fbad7052ed909b1c5aee2eeebe0 /third_party/ijar/zip_main.cc
parentac5451532ee078f963d1d784155469d6a5d67524 (diff)
Fix %O format string in ijar's zipper
Also remove the leading slash when flattening files Fixes #219. -- MOS_MIGRATED_REVID=94751441
Diffstat (limited to 'third_party/ijar/zip_main.cc')
-rw-r--r--third_party/ijar/zip_main.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/third_party/ijar/zip_main.cc b/third_party/ijar/zip_main.cc
index 8436da40f2..096662368c 100644
--- a/third_party/ijar/zip_main.cc
+++ b/third_party/ijar/zip_main.cc
@@ -117,7 +117,7 @@ void UnzipProcessor::Process(const char* filename, const u4 attr,
mode_t perm = mode & 0777;
bool isdir = (mode & S_IFDIR) != 0;
if (verbose_) {
- printf("%c %O %s\n", isdir ? 'd' : 'f', perm, filename);
+ printf("%c %o %s\n", isdir ? 'd' : 'f', perm, filename);
}
if (extract_) {
char path[PATH_MAX];
@@ -143,6 +143,8 @@ void basename(const char *path, char *output, size_t output_size) {
const char *pointer = strrchr(path, '/');
if (pointer == NULL) {
pointer = path;
+ } else {
+ pointer++; // Skip the leading slash.
}
strncpy(output, pointer, output_size);
output[output_size-1] = 0;
@@ -208,7 +210,7 @@ int create(char *zipfile, char **files, bool flatten, bool verbose) {
if (verbose) {
mode_t perm = statst.st_mode & 0777;
- printf("%c %O %s\n", isdir ? 'd' : 'f', perm, path);
+ printf("%c %o %s\n", isdir ? 'd' : 'f', perm, path);
}
u1 *buffer = builder->NewFile(path, mode_to_zipattr(statst.st_mode));