X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=archive-zip.c;h=74e30f6205f41112dc2bafe9371a790aca55f70c;hb=79f43f3de8d992f141e1b08ab8f7bce5e66947f9;hp=f63dff383483c482b414432b697306c53b320d00;hpb=357c5e086c28581918329281be18ab236d33967f;p=git.git diff --git a/archive-zip.c b/archive-zip.c index f63dff383..74e30f620 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -192,7 +192,8 @@ static int write_zip_entry(const unsigned char *sha1, compressed_size = 0; } else if (S_ISREG(mode) || S_ISLNK(mode)) { method = 0; - attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) : 0; + attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) : + (mode & 0111) ? ((mode) << 16) : 0; if (S_ISREG(mode) && zlib_compression_level != 0) method = 8; result = 0; @@ -231,7 +232,8 @@ static int write_zip_entry(const unsigned char *sha1, } copy_le32(dirent.magic, 0x02014b50); - copy_le16(dirent.creator_version, S_ISLNK(mode) ? 0x0317 : 0); + copy_le16(dirent.creator_version, + S_ISLNK(mode) || (S_ISREG(mode) && (mode & 0111)) ? 0x0317 : 0); copy_le16(dirent.version, 10); copy_le16(dirent.flags, 0); copy_le16(dirent.compression_method, method);