]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix CID 740322: unchecked lseek return value in disk.cc
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 3 Jul 2015 09:38:18 +0000 (11:38 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 3 Jul 2015 09:38:18 +0000 (11:38 +0200)
src/disk.cc

index bd461f712aa375f8b70cc118d892df517a6ee472..a5ee68090915c5d93540f2dc90d2b1311317b1c0 100644 (file)
@@ -421,7 +421,12 @@ diskHandleRead(int fd, void *data)
     {
 #endif
         debugs(6, 3, "diskHandleRead: FD " << fd << " seeking to offset " << ctrl_dat->offset);
-        lseek(fd, ctrl_dat->offset, SEEK_SET);  /* XXX ignore return? */
+        errno = 0;
+        if (lseek(fd, ctrl_dat->offset, SEEK_SET) == -1) {
+            // shouldn't happen, let's detect that
+            debugs(50, DBG_IMPORTANT, "error in seek for fd " << fd << ": " << xstrerror());
+            // XXX handle failures?
+        }
         ++ statCounter.syscalls.disk.seeks;
         F->disk.offset = ctrl_dat->offset;
     }