Parcourir la source

[1704] fd_ cannot be -1 here

Mukund Sivaraman il y a 13 ans
Parent
commit
db2fa0cd17
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      src/lib/util/interprocess_sync_file.cc

+ 3 - 3
src/lib/util/interprocess_sync_file.cc

@@ -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);
     }