summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2003-05-05 22:27:37 +0000
committergad <gad@FreeBSD.org>2003-05-05 22:27:37 +0000
commit2e101cf42bcedd60b9f18df6082dffdf52b8ca77 (patch)
treeade5c4ae64ed77b05d755bd0430809977ab2eed5 /usr.sbin/newsyslog
parent5bee64a168a120c521117fb52c91c9ab1ae01d13 (diff)
downloadFreeBSD-src-2e101cf42bcedd60b9f18df6082dffdf52b8ca77.zip
FreeBSD-src-2e101cf42bcedd60b9f18df6082dffdf52b8ca77.tar.gz
Slightly improve the checking of the 'size' field, so people will get
a warning message if they switch the values for 'size' and 'when'. MFC after: 1 week
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index ae5a224..d70d744 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -155,6 +155,7 @@ static time_t parseDWM(char *s, char *errline);
* range 0 to 255, plus EOF. Define wrappers which can take
* values of type 'char', either signed or unsigned.
*/
+#define isdigitch(Anychar) isdigit(((int) Anychar) & 255)
#define isprintch(Anychar) isprint(((int) Anychar) & 255)
#define isspacech(Anychar) isspace(((int) Anychar) & 255)
#define tolowerch(Anychar) tolower(((int) Anychar) & 255)
@@ -949,10 +950,15 @@ parse_file(FILE *cf, const char *cfname, struct conf_entry **work_p,
errx(1, "malformed line (missing fields):\n%s",
errline);
*parse = '\0';
- if (isdigit(*q))
+ if (isdigitch(*q))
working->size = atoi(q);
- else
+ else if (strcmp(q,"*") == 0)
+ working->size = -1;
+ else {
+ warnx("Invalid value of '%s' for 'size' in line:\n%s",
+ q, errline);
working->size = -1;
+ }
working->flags = 0;
q = parse = missing_field(sob(++parse), errline);
OpenPOWER on IntegriCloud