]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
unlinkd: Compiler warning cleanups
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 14 Nov 2012 02:30:30 +0000 (19:30 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 14 Nov 2012 02:30:30 +0000 (19:30 -0700)
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

src/unlinkd_daemon.cc

index a143a82625efe3233da9793ffdbf6a801abbce6a..c621e1c464d87791797268a6017ba1485e555b83 100644 (file)
@@ -77,9 +77,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);