diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-09-18 23:23:18 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-09-18 23:23:18 +0000 |
commit | 3d83897449336517ba2d1418c7faab18c41cc11a (patch) | |
tree | dc12f519ccb7f3771d44ae6281bfcbd72995647e /sbin/disklabel | |
parent | dbc8b505ca36c9716dc2301c81b830100f415ccd (diff) |
remove unused var, and then fix the code to watch for waitpid() errors
ok otto millert
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/disklabel.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 24ec70ee215..b3b050f180d 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.90 2004/08/08 19:04:25 deraadt Exp $ */ +/* $OpenBSD: disklabel.c,v 1.91 2004/09/18 23:23:17 deraadt Exp $ */ /* * Copyright (c) 1987, 1993 @@ -39,7 +39,7 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.90 2004/08/08 19:04:25 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.91 2004/09/18 23:23:17 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -1189,8 +1189,8 @@ edit(struct disklabel *lp, int f) int editit(void) { - pid_t pid, xpid; - int stat, len; + pid_t pid; + int stat = 0, len; char *argp[] = {"sh", "-c", NULL, NULL}; char *ed, *p; @@ -1224,7 +1224,13 @@ editit(void) } free(p); for (;;) { - xpid = waitpid(pid, (int *)&stat, WUNTRACED); + if (waitpid(pid, (int *)&stat, WUNTRACED) == -1) { + if (errno == EINTR) + continue; + if (errno == ECHILD) + stat = 1; + break; + } if (WIFSTOPPED(stat)) raise(WSTOPSIG(stat)); else if (WIFEXITED(stat)) |