diff options
author | Elliott Hughes <enh@google.com> | 2017-02-19 09:22:45 -0800 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2017-02-20 22:21:58 -0600 |
commit | fd5687662c581b9f94a9076a3cd7436560682cf2 (patch) | |
tree | 8b6024e81d5fea65146cd8bb1542636688c68bc2 /lib | |
parent | fd866b2f058294cf51a6987a1786ff1bd9e6b1ea (diff) | |
download | toybox-fd5687662c581b9f94a9076a3cd7436560682cf2.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; } |