From 4524c578581b427145ae136844fc655a89e94777 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 27 Mar 2023 18:35:46 -0700 Subject: Set close-on-exec when opening files Relies on platforms with O_CLOEXEC support following POSIX requirement to not copy the close-on-exec flag to the new fd in dup2(), but to leave it unset instead, since that's how fd's are passed to child processes to handled compressed files. Signed-off-by: Alan Coopersmith --- src/rgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rgb.c') diff --git a/src/rgb.c b/src/rgb.c index 5c350eb..de0d17f 100644 --- a/src/rgb.c +++ b/src/rgb.c @@ -66,7 +66,7 @@ xpmReadRgbNames( xpmRgbName *rgb; /* Open the rgb text file. Abort if error. */ - if ((rgbf = fopen(rgb_fname, "r")) == NULL) + if ((rgbf = fopen(rgb_fname, "r" FOPEN_CLOEXEC)) == NULL) return 0; /* Loop reading each line in the file. */ -- cgit v1.2.1