Browse Source

FD_CLOEXEC flag for klish lock

Serj Kalichev 9 years ago
parent
commit
c2ca1e0f67
1 changed files with 3 additions and 0 deletions
  1. 3 0
      clish/shell/shell_execute.c

+ 3 - 0
clish/shell/shell_execute.c

@@ -224,6 +224,9 @@ static int clish_shell_lock(const char *lock_path)
 		fprintf(stderr, "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;