浏览代码

FD_CLOEXEC flag for klish lock

Serj Kalichev 10 年之前
父节点
当前提交
02a4a10f5d
共有 1 个文件被更改,包括 3 次插入0 次删除
  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;