rogue(6): Fix broken aliasing for -O2 or higher.
authorSascha Wildner <saw@online.de>
Fri, 9 Oct 2009 18:55:05 +0000 (20:55 +0200)
committerSascha Wildner <saw@online.de>
Fri, 9 Oct 2009 18:55:05 +0000 (20:55 +0200)
Fix taken from OpenBSD.

Submitted-by: Ulrich Spoerlein <uqs@spoerlein.net>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1551>

games/rogue/machdep.c

index ae9e39a..3d8abe4 100644 (file)
@@ -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 */