From fd5687662c581b9f94a9076a3cd7436560682cf2 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sun, 19 Feb 2017 09:22:45 -0800 Subject: 4a4b3d65644ce403b0f22887fc0d38b0202ec8c7 upset clang. Recent-ish clang doesn't like self-assignment. Google/Android code always uses the [template-based moral equivalent of] __attribute__((__unused__)) to keep both compilers happy. --- lib/lib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/lib.c') diff --git a/lib/lib.c b/lib/lib.c index 6f7ed303..f6776142 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -634,6 +634,7 @@ int copy_tempfile(int fdin, char *name, char **tempname) { struct stat statbuf; int fd; + int ignored __attribute__((__unused__)); *tempname = xmprintf("%s%s", name, "XXXXXX"); if(-1 == (fd = mkstemp(*tempname))) error_exit("no temp file"); @@ -648,9 +649,9 @@ int copy_tempfile(int fdin, char *name, char **tempname) // We chmod before chown, which strips the suid bit. Caller has to explicitly // switch it back on if they want to keep suid. - // I said IGNORING ERRORS. Both gcc and clang clutch their pearls about this - // but it's _supposed_ to fail when we're not root. - if (fchown(fd, statbuf.st_uid, statbuf.st_gid)) fd = fd; + // Suppress warn-unused-result. Both gcc and clang clutch their pearls about + // this but it's _supposed_ to fail when we're not root. + ignored = fchown(fd, statbuf.st_uid, statbuf.st_gid); return fd; } -- cgit v1.2.3