aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael S. Fischer <mfischer@zendesk.com>2015-06-02 16:29:57 -0700
committerLuis Hector Chavez <lhchavez@google.com>2017-11-17 09:16:14 -0800
commitc07451606ba95bd4666df6d4251017de4928b0f3 (patch)
tree65e1b1ed30e76bc01bb1e8639045dd365a81cb51
parentde36999a73617500d83379e36c23ae4cc2b12a7e (diff)
downloadsquashfs-tools-c07451606ba95bd4666df6d4251017de4928b0f3.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. (cherry picked from commit f66e57a34ea0524a4b3cb69872c8406f81a2c746)
-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 7f46968..0dbc4c2 100644
--- a/squashfs-tools/unsquashfs.c
+++ b/squashfs-tools/unsquashfs.c
@@ -826,8 +826,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));
@@ -850,6 +848,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;
}