diff options
Diffstat (limited to 'sbin/scsi/scsi.c')
-rw-r--r-- | sbin/scsi/scsi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/scsi/scsi.c b/sbin/scsi/scsi.c index 35526a380d7..eea7caee0ea 100644 --- a/sbin/scsi/scsi.c +++ b/sbin/scsi/scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi.c,v 1.22 2006/10/10 21:38:16 cloder Exp $ */ +/* $OpenBSD: scsi.c,v 1.23 2006/10/13 02:11:28 cloder Exp $ */ /* $FreeBSD: scsi.c,v 1.11 1996/04/06 11:00:28 joerg Exp $ */ /* @@ -621,10 +621,13 @@ edit_get(void *hook, char *name) if (editinfo[editind].can_edit) { char line[80]; + size_t len; if (fgets(line, sizeof(line), edit_file) == NULL) err(errno, "fgets"); - line[strlen(line) - 1] = 0; + len = strlen(line); + if (len && line[len - 1] == '\n') + line[len - 1] = '\0'; if (strncmp(name, line, strlen(name)) != 0) { fprintf(stderr, "Expected \"%s\" and read \"%s\"\n", |