diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-05 07:18:44 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-04-05 07:18:44 +0000 |
commit | 137f6e72f7f904ad49685ed6daad783ee0009e2b (patch) | |
tree | 1cf43bdc1cec5a0fc129da6b10a9dea1f3b89c1b /usr.bin/vacation/vacation.c | |
parent | 65b5a567e90ae7f4282f97560ec9b1830dbee9fc (diff) |
cope with fdopen failure better
Diffstat (limited to 'usr.bin/vacation/vacation.c')
-rw-r--r-- | usr.bin/vacation/vacation.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/vacation/vacation.c b/usr.bin/vacation/vacation.c index 8dceee4cea6..85c7f773c35 100644 --- a/usr.bin/vacation/vacation.c +++ b/usr.bin/vacation/vacation.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vacation.c,v 1.22 2004/03/08 19:08:03 deraadt Exp $ */ +/* $OpenBSD: vacation.c,v 1.23 2004/04/05 07:18:43 deraadt Exp $ */ /* $NetBSD: vacation.c,v 1.7 1995/04/29 05:58:27 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)vacation.c 8.2 (Berkeley) 1/26/94"; #endif -static char rcsid[] = "$OpenBSD: vacation.c,v 1.22 2004/03/08 19:08:03 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: vacation.c,v 1.23 2004/04/05 07:18:43 deraadt Exp $"; #endif /* not lint */ /* @@ -129,7 +129,6 @@ main(int argc, char *argv[]) } else interval = (time_t)LONG_MAX; /* XXX */ break; - case '?': default: usage(); } @@ -470,6 +469,12 @@ sendmessage(char *myname) } close(pvect[0]); sfp = fdopen(pvect[1], "w"); + if (sfp == NULL) { + /* XXX could not fdopen; likely out of memory */ + fclose(mfp); + close(pvect[1]); + return; + } fprintf(sfp, "To: %s\n", from); while (fgets(buf, sizeof buf, mfp)) { char *s = strstr(buf, "$SUBJECT"); |