aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@FreeBSD.org>2015-09-22 07:40:55 +0000
committerCraig Rodrigues <rodrigc@FreeBSD.org>2015-09-22 07:40:55 +0000
commit3e2981e8b8c54193aa56ea3bd9551c4c6851b35b (patch)
tree1a8409e32f2be1f3e690252fe2662c30d9bcf36e /lib/libc
parent996f7159b1b1e7321ee4c1fdd98dcec33a9609eb (diff)
downloadsrc-3e2981e8b8c54193aa56ea3bd9551c4c6851b35b.tar.gz
src-3e2981e8b8c54193aa56ea3bd9551c4c6851b35b.zip
Use proper function prototype for readdir().
Eliminates -Wstrict-prototypes warning Submitted by: Joerg Sonnenberger <joerg@dragonflybsd.org> Obtained from: DragonFlyBSD (commit 2a6aec8dab58c89961cabcfdb92e0d0ae256dea4)
Notes
Notes: svn path=/head/; revision=288098
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/glob.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index 95a3a060b3bf..971d616e43e4 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -650,13 +650,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
int err;
char buf[MAXPATHLEN];
- /*
- * The readdirfunc declaration can't be prototyped, because it is
- * assigned, below, to two functions which are prototyped in glob.h
- * and dirent.h as taking pointers to differently typed opaque
- * structures.
- */
- struct dirent *(*readdirfunc)();
+ struct dirent *(*readdirfunc)(DIR *);
if (pathend > pathend_last)
return (GLOB_ABORTED);
@@ -677,12 +671,14 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
err = 0;
- /* Search directory for matching names. */
+ /* pglob->gl_readdir takes a void *, fix this manually */
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- readdirfunc = pglob->gl_readdir;
+ readdirfunc = (struct dirent *(*)(DIR *))pglob->gl_readdir;
else
readdirfunc = readdir;
- while ((dp = (*readdirfunc)(dirp))) {
+
+ /* Search directory for matching names. */
+ while ((dp = (*readdirfunc)(dirp)) != NULL) {
char *sc;
Char *dc;
wchar_t wc;