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.
diff --git a/lib/lib.c b/lib/lib.c
index 6f7ed30..f677614 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -634,6 +634,7 @@
{
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 @@
// 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;
}