Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170331050243.4485-1-quae@daurnimator.com>
Date: Fri, 31 Mar 2017 16:02:43 +1100
From: daurnimator <quae@...rnimator.com>
To: musl@...ts.openwall.com
Cc: daurnimator <quae@...rnimator.com>
Subject: [PATCH] add support for POSIX_SPAWN_SETSID

This patch adds support for the POSIX_SPAWN_SETSID flag.

It was recently accepted by the Austin Group:
http://austingroupbugs.net/view.php?id=1044

---
 include/spawn.h           | 1 +
 src/process/posix_spawn.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/include/spawn.h b/include/spawn.h
index 29c799ee..7dee7cfa 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -21,6 +21,7 @@ struct sched_param;
 #define POSIX_SPAWN_SETSIGMASK 8
 #define POSIX_SPAWN_SETSCHEDPARAM 16
 #define POSIX_SPAWN_SETSCHEDULER 32
+#define POSIX_SPAWN_SETSID 64
 
 typedef struct {
 	int __flags;
diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
index 0bdf71cd..03392ba8 100644
--- a/src/process/posix_spawn.c
+++ b/src/process/posix_spawn.c
@@ -73,6 +73,10 @@ static int child(void *args_vp)
 		__libc_sigaction(i, &sa, 0);
 	}
 
+	if (attr->__flags & POSIX_SPAWN_SETSID)
+		if ((ret=__syscall(SYS_setsid)))
+			goto fail;
+
 	if (attr->__flags & POSIX_SPAWN_SETPGROUP)
 		if ((ret=__syscall(SYS_setpgid, 0, attr->__pgrp)))
 			goto fail;
-- 
2.12.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.