]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1704] fd_ cannot be -1 here
authorMukund Sivaraman <muks@isc.org>
Thu, 24 May 2012 05:49:59 +0000 (11:19 +0530)
committerMukund Sivaraman <muks@isc.org>
Thu, 24 May 2012 05:49:59 +0000 (11:19 +0530)
src/lib/util/interprocess_sync_file.cc

index bb31745a2442c6edfb06c204dfc18db96c981b86..197b63f6d3e203b6fa776f04e801115cf3e006d2 100644 (file)
@@ -87,7 +87,7 @@ InterprocessSyncFile::lock() {
         return (true);
     }
 
-    if ((fd_ != -1) && do_lock(fd_, F_SETLKW, F_WRLCK)) {
+    if (do_lock(fd_, F_SETLKW, F_WRLCK)) {
         is_locked_ = true;
         return (true);
     }
@@ -101,7 +101,7 @@ InterprocessSyncFile::tryLock() {
         return (true);
     }
 
-    if ((fd_ != -1) && do_lock(fd_, F_SETLK, F_WRLCK)) {
+    if (do_lock(fd_, F_SETLK, F_WRLCK)) {
         is_locked_ = true;
         return (true);
     }
@@ -115,7 +115,7 @@ InterprocessSyncFile::unlock() {
         return (true);
     }
 
-    if ((fd_ != -1) && do_lock(fd_, F_SETLKW, F_UNLCK)) {
+    if (do_lock(fd_, F_SETLKW, F_UNLCK)) {
         is_locked_ = false;
         return (true);
     }