From: Sascha Wildner Date: Fri, 9 Oct 2009 18:55:05 +0000 (+0200) Subject: rogue(6): Fix broken aliasing for -O2 or higher. X-Git-Url: https://gitweb.dragonflybsd.org/~syl/dragonfly.git/commitdiff_plain/0a297dbb7d948c7b68f69f3ca5a5deec1505eec7 rogue(6): Fix broken aliasing for -O2 or higher. Fix taken from OpenBSD. Submitted-by: Ulrich Spoerlein Dragonfly-bug: --- diff --git a/games/rogue/machdep.c b/games/rogue/machdep.c index ae9e39a60a..3d8abe435c 100644 --- a/games/rogue/machdep.c +++ b/games/rogue/machdep.c @@ -536,14 +536,22 @@ md_lock(boolean l) void md_shell(const char *shell) { - long w[2]; - - if (!fork()) { + int w; + pid_t pid; + + pid = fork(); + switch (pid) { + case -1: + break; + case 0: /* revoke */ setgid(getgid()); execl(shell, shell, NULL); + _exit(255); + default: + waitpid(pid, &w, 0); + break; } - wait((int *)w); } #endif /* UNIX */