From 017d1deaf923887df74b068c33d080008b0c25cf Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 27 Mar 2023 16:23:55 -0700 Subject: XmuReadBitmapDataFromFile: set close-on-exec when opening files Signed-off-by: Alan Coopersmith --- src/RdBitF.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/RdBitF.c b/src/RdBitF.c index df379c5..eb60844 100644 --- a/src/RdBitF.c +++ b/src/RdBitF.c @@ -59,6 +59,12 @@ in this Software without prior written authorization from The Open Group. #include /* for _getdrives() */ #endif +#ifdef O_CLOEXEC +#define FOPEN_CLOEXEC "e" +#else +#define FOPEN_CLOEXEC "" +#endif + #define MAX_SIZE 255 /* @@ -384,7 +390,7 @@ XmuReadBitmapDataFromFile(_Xconst char *filename, unsigned int *width, FILE *fstream; int status; - if ((fstream = fopen_file (filename, "r")) == NULL) { + if ((fstream = fopen_file (filename, "r" FOPEN_CLOEXEC)) == NULL) { return BitmapOpenFailed; } status = XmuReadBitmapData(fstream, width, height, datap, x_hot, y_hot); -- cgit v1.2.1