]> code.delx.au - pulseaudio/commitdiff
core-util: Call fchown() only when necessary
authorBradley Broom <bmbroom@gmail.com>
Fri, 25 Apr 2014 10:00:00 +0000 (13:00 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Fri, 25 Apr 2014 10:00:00 +0000 (13:00 +0300)
This reportedly fixes some cases where the home directory is on NFS.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=45656
src/pulsecore/core-util.c

index 0d9e354d16cf993a443e3b258d40d8063111a108..3e2c615ffa67c024e6d0e573e0009c0838223ba6 100644 (file)
@@ -336,7 +336,7 @@ again:
         uid = getuid();
     if (gid == (gid_t) -1)
         gid = getgid();
-    if (fchown(fd, uid, gid) < 0) {
+    if (((st.st_uid != uid) || (st.st_gid != gid)) && fchown(fd, uid, gid) < 0) {
         pa_assert_se(pa_close(fd) >= 0);
         goto fail;
     }