mirror of
https://github.com/systemd/systemd.git
synced 2026-08-05 07:30:30 +00:00
Merge pull request #8101 from keszybz/two-gcc-workarounds
Two gcc workarounds
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)
|
||||
|
||||
@@ -328,6 +328,8 @@ fail:
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wsizeof-pointer-memaccess"
|
||||
|
||||
enum nss_status _nss_systemd_getgrnam_r(
|
||||
const char *name,
|
||||
struct group *gr,
|
||||
|
||||
@@ -49,12 +49,16 @@ static void test_glob_exists(void) {
|
||||
assert_se(r == 0);
|
||||
}
|
||||
|
||||
static void _closedir(void* v) {
|
||||
(void) closedir(v);
|
||||
}
|
||||
|
||||
static void test_glob_no_dot(void) {
|
||||
char template[] = "/tmp/test-glob-util.XXXXXXX";
|
||||
const char *fn;
|
||||
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
.gl_closedir = (void (*)(void *)) closedir,
|
||||
.gl_closedir = _closedir,
|
||||
.gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
|
||||
.gl_opendir = (void *(*)(const char *)) opendir,
|
||||
.gl_lstat = lstat,
|
||||
|
||||
Reference in New Issue
Block a user