------------------------------------------------------------ revno: 12394 revision-id: squid3@treenet.co.nz-20121124020115-o6gr2gn7dz2bad0i parent: squid3@treenet.co.nz-20121124015949-pqzjpda8ywzmzno1 committer: Amos Jeffries branch nick: 3.3 timestamp: Fri 2012-11-23 19:01:15 -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-20121124020115-o6gr2gn7dz2bad0i # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 0ab5e1398b9f9939615825b6678fc932648f1e57 # timestamp: 2012-11-24 02:04:47 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121124015949-\ # pqzjpda8ywzmzno1 # # Begin patch === modified file 'src/unlinkd_daemon.cc' --- src/unlinkd_daemon.cc 2012-09-01 14:38:36 +0000 +++ src/unlinkd_daemon.cc 2012-11-24 02:01:15 +0000 @@ -77,9 +77,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);