From 45d1d31847dfc425410a107b66537e567c0d5637 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 28 Feb 2015 12:50:17 +0100 Subject: libthread: use devdup instead of mounting pipe to /mnt/temp for close-on-exec in procexec() the namespace might be shared by other processes. instead, we create a anonymous pipe with pipe() and use devdup to open one end close-on-exec. this is shorter and avoids the race condition. do not touch Execargs after writing the error message as the process might be gone after the write. this was to manually close the fd which isnt neccesary as the kernel will do it for us on the following exit. --- sys/src/libthread/main.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sys/src/libthread/main.c') diff --git a/sys/src/libthread/main.c b/sys/src/libthread/main.c index 03c069c14..708b65ed1 100644 --- a/sys/src/libthread/main.c +++ b/sys/src/libthread/main.c @@ -114,7 +114,6 @@ efork(Execargs *e) if(buf[0]=='\0') strcpy(buf, "exec failed"); write(e->fd[1], buf, strlen(buf)); - close(e->fd[1]); _exits(buf); } -- cgit v1.2.3