diff options
Diffstat (limited to 'usr.sbin/afs')
-rw-r--r-- | usr.sbin/afs/src/lib/cmd/cmd.c | 3 | ||||
-rw-r--r-- | usr.sbin/afs/src/lib/sl/sl.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/afs/src/lib/cmd/cmd.c b/usr.sbin/afs/src/lib/cmd/cmd.c index b86e6e58cbe..ae353768192 100644 --- a/usr.sbin/afs/src/lib/cmd/cmd.c +++ b/usr.sbin/afs/src/lib/cmd/cmd.c @@ -801,7 +801,8 @@ cmd_ExtraText (const char *cmd, const char *sectionname, len = asprintf (§ion, "%%%s %s", class, name); while (fgets (buf, sizeof(buf), f) != NULL) { - buf[strlen(buf)-1] = '\0'; + if (buf[0] != '\0' && buf[strlen(buf) - 1] == '\n') + buf[strlen(buf) - 1] = '\0'; if (buf[0] == '#') continue; diff --git a/usr.sbin/afs/src/lib/sl/sl.c b/usr.sbin/afs/src/lib/sl/sl.c index dde33a6f123..33f8e1c8970 100644 --- a/usr.sbin/afs/src/lib/sl/sl.c +++ b/usr.sbin/afs/src/lib/sl/sl.c @@ -210,7 +210,7 @@ readline(char *prompt) fflush (stdout); if(fgets(buf, sizeof(buf), stdin) == NULL) return NULL; - if (buf[strlen(buf) - 1] == '\n') + if (buf[0] != '\0' && buf[strlen(buf) - 1] == '\n') buf[strlen(buf) - 1] = '\0'; return strdup(buf); } |