Browse Source

[1705] Catch errors

Michal 'vorner' Vaner 13 years ago
parent
commit
16b39f3c24
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/lib/util/io/fd_share.cc

+ 3 - 1
src/lib/util/io/fd_share.cc

@@ -111,7 +111,9 @@ recv_fd(const int sock) {
     // one returned previously, even if that one is not closed yet. So,
     // we just re-number every one we get, so they are unique.
     int new_fd(dup(fd));
-    close(fd);
+    if (close(fd) == -1 || new_fd == -1) {
+        return (FD_SYSTEM_ERROR);
+    }
     return (new_fd);
 }