From: Amos Jeffries Date: Mon, 26 Nov 2012 10:21:01 +0000 (-0700) Subject: unlinkd: Compiler warning cleanups X-Git-Tag: SQUID_3_2_4~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af2d1a482e93534ae21d168ca2d5674a0a3baf7d;p=thirdparty%2Fsquid.git unlinkd: Compiler warning cleanups Check the return value for open(/dev/null). Nothing we can do about it since the daemon has already disconnected from cache.log but note that. Detected by Coverity Scan. Issue 740328 --- diff --git a/src/unlinkd_daemon.cc b/src/unlinkd_daemon.cc index e9dbf53e5e..126472b2f3 100644 --- a/src/unlinkd_daemon.cc +++ b/src/unlinkd_daemon.cc @@ -79,9 +79,11 @@ main(int argc, char *argv[]) setbuf(stdin, NULL); setbuf(stdout, NULL); close(2); - open(_PATH_DEVNULL, O_RDWR); + if (open(_PATH_DEVNULL, O_RDWR) < 0) { + ; // the irony of having to close(2) earlier is that we cannot report this failure. + } - while (fgets(buf, UNLINK_BUF_LEN, stdin)) { + while (fgets(buf, sizeof(buf), stdin)) { if ((t = strchr(buf, '\n'))) *t = '\0'; x = unlink(buf);