diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2011-01-21 18:58:56 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2011-01-21 18:58:56 +0000 |
commit | 2639ca626ec6e980ba8978747e374c20f040f4b6 (patch) | |
tree | ddbc7777d762708dbb99061d872c9da9859e23b5 /usr.bin/mg | |
parent | 72c7c7d6cc3aef58004bd2d72bc933dd2079d9f5 (diff) |
Change len+memcmp check to a strncmp for prefix testing on
filename completion. Avoids a recurring portability headache.
ok lum@
"concerns assuaged to the soothing sounds of Martin Denny blambert@"
(I worry about that guy...)
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/fileio.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index 1f4c40c8fdb..0e19fc0f1ae 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.82 2008/09/15 16:11:35 kjell Exp $ */ +/* $OpenBSD: fileio.c,v 1.83 2011/01/21 18:58:55 kjell Exp $ */ /* This file is in the public domain. */ @@ -529,10 +529,8 @@ make_file_list(char *buf) while ((dent = readdir(dirp)) != NULL) { int isdir; - - if (dent->d_namlen < len || memcmp(cp, dent->d_name, len) != 0) + if (strncmp(cp, dent->d_name, len) != 0) continue; - isdir = 0; if (dent->d_type == DT_DIR) { isdir = 1; |