diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-01-01 18:44:09 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-01-01 18:44:09 -0500 |
commit | f6829ebb5730ec0ee2908ec390b04fc28374f88d (patch) | |
tree | 0d337d73c95990eaecf4d5b3e43c2172c959cd4e /src/lpm.c | |
parent | 702c1611985f5292da8a0d788d5a009bb217b06e (diff) | |
download | lite-xl-plugin-manager-f6829ebb5730ec0ee2908ec390b04fc28374f88d.tar.gz lite-xl-plugin-manager-f6829ebb5730ec0ee2908ec390b04fc28374f88d.zip |
Fixed chmodding on zips.
Diffstat (limited to 'src/lpm.c')
-rw-r--r-- | src/lpm.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -593,14 +593,19 @@ static int lpm_extract(lua_State* L) { zip_close(archive); return luaL_error(L, "can't write file %s: %s", target, strerror(errno)); } + + mode_t m = S_IRUSR | S_IRGRP | S_IROTH; zip_uint8_t os; zip_uint32_t attr; zip_file_get_external_attributes(archive, i, 0, &os, &attr); - mode_t m = S_IRUSR | S_IRGRP | S_IROTH; - if (0 == (attr & FA_RDONLY)) - m |= S_IWUSR | S_IWGRP | S_IWOTH; - if (attr & FA_DIREC) - m = (S_IFDIR | (m & ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH; + if (os == ZIP_OPSYS_DOS) { + if (0 == (attr & FA_RDONLY)) + m |= S_IWUSR | S_IWGRP | S_IWOTH; + if (attr & FA_DIREC) + m = (S_IFDIR | (m & ~S_IFMT)) | S_IXUSR | S_IXGRP | S_IXOTH; + } else { + m = (attr >> 16) & ~0222; + } if (chmod(target, m)) { zip_fclose(zip_file); zip_close(archive); |