Blob Blame History Raw
From 428010b2358fc493feab702c736610028cd9a31a Mon Sep 17 00:00:00 2001
From: Bradley Broom <bmbroom@gmail.com>
Date: Fri, 25 Apr 2014 13:00:00 +0300
Subject: [PATCH 2/3] core-util: Call fchown() only when necessary

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index bdfafd0..c8827ac 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -288,7 +288,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;
     }
-- 
1.9.3