diff options
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/dired.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index ba44d6c0e8d..27c37b4bb4b 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dired.c,v 1.42 2006/11/01 06:02:29 ray Exp $ */ +/* $OpenBSD: dired.c,v 1.43 2007/09/11 15:47:17 gilles Exp $ */ /* This file is in the public domain. */ @@ -622,10 +622,7 @@ dired_(char *dname) } line[0] = line[1] = ' '; while (fgets(&line[2], sizeof(line) - 2, dirpipe) != NULL) { - char *p; - - if ((p = strchr(line, '\n')) != NULL) - *p = '\0'; /* remove ^J */ + line[strcspn(line, "\n")] = '\0'; /* remove ^J */ (void) addline(bp, line); } if (pclose(dirpipe) == -1) { |