Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/mail - 1 -> EXIT_FAILURE
details: https://anonhg.NetBSD.org/src/rev/a70cb1ed8e5f
branches: trunk
changeset: 750726:a70cb1ed8e5f
user: christos <christos%NetBSD.org@localhost>
date: Tue Jan 12 14:44:24 2010 +0000
description:
- 1 -> EXIT_FAILURE
- avoid assertion firing when hitting ^D in CC: line.
diffstat:
usr.bin/mail/complete.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diffs (55 lines):
diff -r 07b3dd2e7e6d -r a70cb1ed8e5f usr.bin/mail/complete.c
--- a/usr.bin/mail/complete.c Tue Jan 12 14:43:31 2010 +0000
+++ b/usr.bin/mail/complete.c Tue Jan 12 14:44:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: complete.c,v 1.19 2009/04/10 13:08:24 christos Exp $ */
+/* $NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $ */
/*-
* Copyright (c) 1997-2000,2005,2006 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: complete.c,v 1.19 2009/04/10 13:08:24 christos Exp $");
+__RCSID("$NetBSD: complete.c,v 1.20 2010/01/12 14:44:24 christos Exp $");
#endif /* not lint */
/*
@@ -178,7 +178,7 @@
p = sl_init();
if (p == NULL)
- err(1, "Unable to allocate memory for stringlist");
+ err(EXIT_FAILURE, "Unable to allocate memory for stringlist");
return p;
}
@@ -191,7 +191,7 @@
{
if (sl_add(sl, i) == -1)
- err(1, "Unable to add `%s' to stringlist", i);
+ err(EXIT_FAILURE, "Unable to add `%s' to stringlist", i);
}
@@ -1143,12 +1143,13 @@
return NULL;
}
- assert(cnt > 0);
- if (buf[cnt - 1] == '\n')
- cnt--; /* trash the trailing LF */
+ if (cnt > 0) {
+ if (buf[cnt - 1] == '\n')
+ cnt--; /* trash the trailing LF */
- len = MIN(sizeof(line) - 1, (size_t)cnt);
- (void)memcpy(line, buf, len);
+ len = MIN(sizeof(line) - 1, (size_t)cnt);
+ (void)memcpy(line, buf, len);
+ }
line[cnt] = '\0';
/* enter non-empty lines into history */
Home |
Main Index |
Thread Index |
Old Index