瀏覽代碼

fix fcntl() call so that it actually forces file to be closed on exec()

Mike Frysinger 19 年之前
父節點
當前提交
49dd969022
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      libc/misc/utmp/utent.c

+ 1 - 1
libc/misc/utmp/utent.c

@@ -60,7 +60,7 @@ void setutent(void)
 	/* Make sure the file will be closed on exec()  */
 	/* Make sure the file will be closed on exec()  */
 	ret = fcntl(static_fd, F_GETFD, 0);
 	ret = fcntl(static_fd, F_GETFD, 0);
 	if (ret >= 0) {
 	if (ret >= 0) {
-	    ret = fcntl(static_fd, F_GETFD, 0);
+	    ret = fcntl(static_fd, F_SETFD, ret | FD_CLOEXEC);
 	}
 	}
 	if (ret < 0) {
 	if (ret < 0) {
 bummer:
 bummer: