------------------------------------------------------------ revno: 11711 revision-id: squid3@treenet.co.nz-20121126102101-m5sgutjl10nfx1jx parent: squid3@treenet.co.nz-20121126083549-wx9ejjptknp7r7fa committer: Amos Jeffries branch nick: 3.2 timestamp: Mon 2012-11-26 03:21:01 -0700 message: 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 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121126102101-m5sgutjl10nfx1jx # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: 8a2126a044e2ae3bef4fb89fdb1694a5319d3c29 # timestamp: 2012-11-26 10:24:54 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20121126083549-\ # wx9ejjptknp7r7fa # # Begin patch === modified file 'src/unlinkd_daemon.cc' --- src/unlinkd_daemon.cc 2012-02-05 06:09:46 +0000 +++ src/unlinkd_daemon.cc 2012-11-26 10:21:01 +0000 @@ -79,9 +79,11 @@ 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);