]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Silently ignore lchmod failure in when not supported 82/head
authorRomain Fliedel <rfliedel@freebox.fr>
Fri, 20 Jun 2014 13:45:09 +0000 (15:45 +0200)
committerRomain Fliedel <rfliedel@freebox.fr>
Fri, 20 Jun 2014 13:45:09 +0000 (15:45 +0200)
lchmod might be defined but not supported by the platform,
(this is the case with musl implementation of fchmodat) in
this case we can safely ignore the error.

libarchive/archive_write_disk_posix.c

index 3deb5515c54415edc029e9b637775092765e142a..ff2173f218b65d1b54b24226a0d7265c48ed9d13 100644 (file)
@@ -3056,9 +3056,21 @@ set_mode(struct archive_write_disk *a, int mode)
                 * impact.
                 */
                if (lchmod(a->name, mode) != 0) {
-                       archive_set_error(&a->archive, errno,
-                           "Can't set permissions to 0%o", (int)mode);
-                       r = ARCHIVE_WARN;
+                       switch (errno) {
+                       case ENOTSUP:
+                       case ENOSYS:
+                       case EOPNOTSUPP:
+                               /*
+                                * if lchmod is defined but the platform
+                                * doesn't support it, silently ignore
+                                * error
+                                */
+                               break;
+                       default:
+                               archive_set_error(&a->archive, errno,
+                                   "Can't set permissions to 0%o", (int)mode);
+                               r = ARCHIVE_WARN;
+                       }
                }
 #endif
        } else if (!S_ISDIR(a->mode)) {