Sfoglia il codice sorgente

FD_CLOEXEC flag for klish lock

Serj Kalichev 10 anni fa
parent
commit
02a4a10f5d
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      clish/shell/shell_execute.c

+ 3 - 0
clish/shell/shell_execute.c

@@ -32,6 +32,9 @@ static int clish_shell_lock(const char *lock_path)
 		fprintf(stderr, "Warning: Can't open lockfile %s.\n", lock_path);
 		return -1;
 	}
+#ifdef FD_CLOEXEC
+	fcntl(lock_fd, F_SETFD, fcntl(lock_fd, F_GETFD) | FD_CLOEXEC);
+#endif
 	lock.l_type = F_WRLCK;
 	lock.l_whence = SEEK_SET;
 	lock.l_start = 0;