Hi, The current setsid utility forks a new process only if its process is group leader. But for setsid to work, it needs to spawn a new process in any case. e.g. the following (dumb) Makefile will not give bake the control when run: ----- all: setsid cat ----- While calling directly "setsid cat" from a shell will return immediatly. The behaviour of the former is corrected if setsid always forks a new process before calling setsid(). Signed-off-by: Mathias Kende <mathias@xxxxxxxx> ------------- --- sys-utils/setsid.c.orig 2008-07-17 23:12:38.000000000 +0200 +++ sys-utils/setsid.c 2008-07-17 23:19:57.000000000 +0200 @@ -9,6 +9,9 @@ * 2001-01-18 John Fremlin <vii@xxxxxxxxxxxxxxxxxx> * - fork in case we are process group leader * + * 2008-07-17 Mathias Kende <mathias@xxxxxxxx> + * - always fork before calling setsid() + * */ #include <stdio.h> @@ -27,16 +30,14 @@ argv[0]); exit(1); } - if (getpgrp() == getpid()) { - switch(fork()){ - case -1: - perror("fork"); - exit(1); - case 0: /* child */ - break; - default: /* parent */ - exit(0); - } + switch(fork()){ + case -1: + perror("fork"); + exit(1); + case 0: /* child */ + break; + default: /* parent */ + exit(0); } if (setsid() < 0) { perror("setsid"); /* cannot happen */ -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html