Browse Source

[1704] fd_ cannot be -1 here

Mukund Sivaraman 13 years ago
parent
commit
db2fa0cd17
1 changed files with 3 additions and 3 deletions
  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);
     }