Module Name:    xsrc
Committed By:   wiz
Date:           Sat Feb 28 17:27:14 UTC 2015

Modified Files:
        xsrc/external/mit/xsm/dist: auth.c choose.c lock.c remote.c restart.c
            saveutil.c

Log Message:
Switch to the version of the close-on-exec patch that was committed upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xsm/dist/auth.c \
    xsrc/external/mit/xsm/dist/choose.c xsrc/external/mit/xsm/dist/lock.c \
    xsrc/external/mit/xsm/dist/remote.c xsrc/external/mit/xsm/dist/restart.c \
    xsrc/external/mit/xsm/dist/saveutil.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xsm/dist/auth.c
diff -u xsrc/external/mit/xsm/dist/auth.c:1.2 xsrc/external/mit/xsm/dist/auth.c:1.3
--- xsrc/external/mit/xsm/dist/auth.c:1.2	Thu Sep 18 19:13:50 2014
+++ xsrc/external/mit/xsm/dist/auth.c	Sat Feb 28 17:27:14 2015
@@ -154,26 +154,30 @@ SetAuthentication(int count, IceListenOb
     if ((addAuthFile = unique_filename (path, ".xsm")) == NULL)
 	goto bad;
 
-    if (!(addfp = fopen (addAuthFile, "we")))
+    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, "we")))
+    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, "wbe"))) 
+    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, "wbe"))) 
+    if (!(removefp = fdopen(fd, "wb"))) 
 	goto bad;
+    fcntl(fileno(removefp), F_SETFD, FD_CLOEXEC);
 #endif
 
     if ((*authDataEntries = (IceAuthDataEntry *) XtMalloc (
Index: xsrc/external/mit/xsm/dist/choose.c
diff -u xsrc/external/mit/xsm/dist/choose.c:1.2 xsrc/external/mit/xsm/dist/choose.c:1.3
--- xsrc/external/mit/xsm/dist/choose.c:1.2	Thu Sep 18 19:13:50 2014
+++ xsrc/external/mit/xsm/dist/choose.c	Sat Feb 28 17:27:14 2015
@@ -98,7 +98,7 @@ GetSessionNames(int *count_ret, String *
     if ((dir = opendir (path)) == NULL)
 	return 0;
 
-    (void)fcntl(dirfd(dir), F_SETFD, FD_CLOEXEC);
+    fcntl(dirfd(dir), F_SETFD, FD_CLOEXEC);
 
     count = 0;
 
Index: xsrc/external/mit/xsm/dist/lock.c
diff -u xsrc/external/mit/xsm/dist/lock.c:1.2 xsrc/external/mit/xsm/dist/lock.c:1.3
--- xsrc/external/mit/xsm/dist/lock.c:1.2	Thu Sep 18 19:13:50 2014
+++ xsrc/external/mit/xsm/dist/lock.c	Sat Feb 28 17:27:14 2015
@@ -117,10 +117,11 @@ GetLockId(const char *session_name)
     snprintf (lock_file, sizeof(lock_file), "%s/.XSMlock-%s",
 	      path, session_name);
 
-    if ((fp = fopen (lock_file, "re")) == NULL)
+    if ((fp = fopen (lock_file, "r")) == NULL)
     {
 	return (NULL);
     }
+    fcntl(fileno(fp), F_SETFD, FD_CLOEXEC);
 
     buf[0] = '\0';
     fscanf (fp, "%255s\n", buf);
Index: xsrc/external/mit/xsm/dist/remote.c
diff -u xsrc/external/mit/xsm/dist/remote.c:1.2 xsrc/external/mit/xsm/dist/remote.c:1.3
--- xsrc/external/mit/xsm/dist/remote.c:1.2	Thu Sep 18 19:13:50 2014
+++ xsrc/external/mit/xsm/dist/remote.c	Sat Feb 28 17:27:14 2015
@@ -111,7 +111,8 @@ remote_start(const char *restart_protoco
 	default:		/* parent */
 
 	    close (pipefd[0]);
-	    fp = fdopen (pipefd[1], "we");
+	    fcntl(pipefd[1], F_SETFD, FD_CLOEXEC);
+	    fp = fdopen (pipefd[1], "w");
 
 	    fprintf (fp, "CONTEXT X\n");
 	    fprintf (fp, "DIR %s\n", cwd);
Index: xsrc/external/mit/xsm/dist/restart.c
diff -u xsrc/external/mit/xsm/dist/restart.c:1.2 xsrc/external/mit/xsm/dist/restart.c:1.3
--- xsrc/external/mit/xsm/dist/restart.c:1.2	Thu Sep 18 19:13:50 2014
+++ xsrc/external/mit/xsm/dist/restart.c	Sat Feb 28 17:27:14 2015
@@ -531,11 +531,11 @@ StartDefaultApps (void)
 	home = ".";
     snprintf (filename, sizeof(filename), "%s/.xsmstartup", home);
 
-    f = fopen (filename, "re");
+    f = fopen (filename, "r");
 
     if (!f)
     {
-	f = fopen (SYSTEM_INIT_FILE, "re");
+	f = fopen (SYSTEM_INIT_FILE, "r");
 	if (!f)
 	{
 	    printf ("Could not find default apps file.  Make sure you did\n");
@@ -543,6 +543,7 @@ StartDefaultApps (void)
 	    exit (1);
 	}
     }
+    fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
 
     buf = NULL;
     buflen = 0;
Index: xsrc/external/mit/xsm/dist/saveutil.c
diff -u xsrc/external/mit/xsm/dist/saveutil.c:1.2 xsrc/external/mit/xsm/dist/saveutil.c:1.3
--- xsrc/external/mit/xsm/dist/saveutil.c:1.2	Thu Sep 18 19:13:50 2014
+++ xsrc/external/mit/xsm/dist/saveutil.c	Sat Feb 28 17:27:14 2015
@@ -65,13 +65,14 @@ ReadSave(const char *session_name, char 
     int			state, i;
     int			version_number;
 
-    f = fopen(session_save_file, "re");
+    f = fopen(session_save_file, "r");
     if(!f) {
 	if (verbose)
 	    printf("No session save file.\n");
 	*sm_id = NULL;
 	return 0;
     }
+    fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
     if (verbose)
 	printf("Reading session save file...\n");
 
@@ -306,7 +307,7 @@ WriteSave(const char *sm_id)
     char *p, *c;
     int count;
 
-    f = fopen (session_save_file, "we");
+    f = fopen (session_save_file, "w");
 
     if (!f)
     {
@@ -319,6 +320,7 @@ WriteSave(const char *sm_id)
     }
     else
     {
+	fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
 	fprintf (f, "%d\n", SAVEFILE_VERSION);
 	fprintf (f, "%s\n", sm_id);
 
@@ -427,10 +429,11 @@ DeleteSession(const char *session_name)
 
     snprintf (filename, sizeof(filename), "%s/.XSM-%s", dir, session_name);
 
-    f = fopen(filename, "re");
+    f = fopen(filename, "r");
     if(!f) {
 	return (0);
     }
+    fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
 
     buf = NULL;
     buflen = 0;

Reply via email to