summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-03-25 23:23:30 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-03-25 23:23:30 +0000
commita44e442d162ee5606f9d3b13bdb69b7332c1f660 (patch)
tree69f5fd96a66b2dcd491b5daee9bf9e1dd3027e83
parent0499dd034c2ebe80dca6bedbe8014964841ea7d8 (diff)
Change editit() to return -1 on error and 0 on success, like many
other C functions. (Currently this return value is unchecked.)
-rw-r--r--usr.bin/sendbug/sendbug.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c
index 1e71303a359..82d740bebd7 100644
--- a/usr.bin/sendbug/sendbug.c
+++ b/usr.bin/sendbug/sendbug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendbug.c,v 1.17 2007/03/25 23:21:11 ray Exp $ */
+/* $OpenBSD: sendbug.c,v 1.18 2007/03/25 23:23:29 ray Exp $ */
/*
* Written by Ray Lai <ray@cyth.net>.
@@ -179,7 +179,7 @@ editit(char *tmpfile)
if ((ed = getenv("EDITOR")) == (char *)0)
ed = _PATH_VI;
if (asprintf(&p, "%s %s", ed, tmpfile) == -1)
- return (0);
+ return (-1);
argp[2] = p;
top:
@@ -195,7 +195,7 @@ editit(char *tmpfile)
if (saved_errno == EPROCLIM) {
warnx("you have too many processes");
free(p);
- return (0);
+ return (-1);
}
if (saved_errno == EAGAIN) {
sleep(1);
@@ -203,7 +203,7 @@ editit(char *tmpfile)
}
perror("fork");
free(p);
- return (0);
+ return (-1);
}
if (pid == 0) {
(void)signal(SIGHUP, SIG_DFL);
@@ -224,8 +224,8 @@ editit(char *tmpfile)
(void)signal(SIGINT, SIG_DFL);
(void)signal(SIGQUIT, SIG_DFL);
if (!WIFEXITED(stat) || WEXITSTATUS(stat) != 0)
- return (0);
- return (1);
+ return (-1);
+ return (0);
}
int