From 8e0ca659ca19b6e5a9198d623849bef9342ddcdd Mon Sep 17 00:00:00 2001 From: dwmalone Date: Wed, 10 Apr 2002 22:01:37 +0000 Subject: Only remove the '\n' at the end of a line if there is one. I missed this as part of the fix to the PR below. PR: 31265 Submitted by: Matthew D. Fuller MFC after: 1 week --- usr.sbin/cron/lib/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.sbin/cron') diff --git a/usr.sbin/cron/lib/misc.c b/usr.sbin/cron/lib/misc.c index f8538ea..195ff9c 100644 --- a/usr.sbin/cron/lib/misc.c +++ b/usr.sbin/cron/lib/misc.c @@ -392,7 +392,8 @@ in_file(string, file) rewind(file); while (fgets(line, MAX_TEMPSTR, file)) { if (line[0] != '\0') - line[strlen(line)-1] = '\0'; + if (line[strlen(line)-1] == '\n') + line[strlen(line)-1] = '\0'; if (0 == strcmp(line, string)) return TRUE; } -- cgit v1.1