basic/glob-util: add closedir wrapper to silence gcc
../src/test/test-glob-util.c: In function 'test_glob_no_dot':
../src/test/test-glob-util.c:61:32: warning: cast between incompatible function types from 'int (*)(DIR *)' {aka 'int (*)(struct __dirstream *)'} to 'void (*)(void *)' [-Wcast-function-type]
.gl_closedir = (void (*)(void *)) closedir,
^
This commit is contained in:
@@ -29,6 +29,10 @@
|
||||
#include "path-util.h"
|
||||
#include "strv.h"
|
||||
|
||||
static void _closedir(void* v) {
|
||||
(void) closedir(v);
|
||||
}
|
||||
|
||||
int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||
int k;
|
||||
|
||||
@@ -36,7 +40,7 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||
assert(!(flags & GLOB_ALTDIRFUNC));
|
||||
|
||||
if (!pglob->gl_closedir)
|
||||
pglob->gl_closedir = (void (*)(void *)) closedir;
|
||||
pglob->gl_closedir = _closedir;
|
||||
if (!pglob->gl_readdir)
|
||||
pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot;
|
||||
if (!pglob->gl_opendir)
|
||||
|
||||
Reference in New Issue
Block a user