From 6c335e1c315a68283b1303afb06a3d5a34adab83 Mon Sep 17 00:00:00 2001 From: Thomas Klausner Date: Wed, 25 Feb 2015 22:22:50 +0100 Subject: Close file descriptors on exec. Reviewed-by: Alan Coopersmith Signed-off-by: Thomas Klausner --- auth.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'auth.c') diff --git a/auth.c b/auth.c index 5b3bcac..acc4d1e 100644 --- a/auth.c +++ b/auth.c @@ -156,24 +156,28 @@ SetAuthentication(int count, IceListenObj *listenObjs, if (!(addfp = fopen (addAuthFile, "w"))) goto bad; + fcntl(fileno(addfp), F_SETFD, FD_CLOEXEC); if ((remAuthFile = unique_filename (path, ".xsm")) == NULL) goto bad; if (!(removefp = fopen (remAuthFile, "w"))) goto bad; + fcntl(fileno(removefp), F_SETFD, FD_CLOEXEC); #else if ((addAuthFile = unique_filename (path, ".xsm", &fd)) == NULL) goto bad; if (!(addfp = fdopen(fd, "wb"))) goto bad; + fcntl(fileno(addfp), F_SETFD, FD_CLOEXEC); if ((remAuthFile = unique_filename (path, ".xsm", &fd)) == NULL) goto bad; if (!(removefp = fdopen(fd, "wb"))) goto bad; + fcntl(fileno(removefp), F_SETFD, FD_CLOEXEC); #endif if ((*authDataEntries = (IceAuthDataEntry *) XtMalloc ( -- cgit v1.2.3