aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Fischer <mfischer@zendesk.com>2015-06-02 16:29:57 -0700
committerPhillip Lougher <phillip@squashfs.org.uk>2017-07-31 19:10:24 +0100
commitecc20cd3b4b79698fbd1caa2329d320757e00e3e (patch)
tree50df4a3c0e0f692ccfac997d85e4407f4c4f8838
parentc1d1ca267668eeb347bf8376768a5631beeb0b2c (diff)
downloadsquashfs-tools-ecc20cd3b4b79698fbd1caa2329d320757e00e3e.tar.gz
unsquashfs: modify xattrs after other changes
Fixes a bug in which security capabilities were not properly set on written files. chown(2) resets all capabilities so it should be run before setting xattrs instead of afterwards.
-rw-r--r--squashfs-tools/unsquashfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
index 1323dd6..a5f0117 100644
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -821,8 +821,6 @@ int set_attributes(char *pathname, int mode, uid_t uid, gid_t guid, time_t time,
{
struct utimbuf times = { time, time };
- write_xattr(pathname, xattr);
-
if(utime(pathname, &times) == -1) {
ERROR("set_attributes: failed to set time on %s, because %s\n",
pathname, strerror(errno));
@@ -845,6 +843,8 @@ int set_attributes(char *pathname, int mode, uid_t uid, gid_t guid, time_t time,
return FALSE;
}
+ write_xattr(pathname, xattr);
+
return TRUE;
}