summaryrefslogtreecommitdiff
path: root/src/nss-systemd
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-02-05 11:07:40 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-02-05 15:21:07 +0100
commit3c3d384ae93700ef08545b078c37065fdb98eee7 (patch)
tree6be50d7059e34c66f3cfd0668d5067a945be572e /src/nss-systemd
parent1fe101747cb8dcef8c9444bdec4da77930ceaf36 (diff)
downloadsystemd-3c3d384ae93700ef08545b078c37065fdb98eee7.tar.gz
systemd-3c3d384ae93700ef08545b078c37065fdb98eee7.tar.bz2
systemd-3c3d384ae93700ef08545b078c37065fdb98eee7.zip
nss-systemd: add work-around to silence gcc warning
In file included from ../src/basic/fs-util.h:32, from ../src/nss-systemd/nss-systemd.c:28: ../src/nss-systemd/nss-systemd.c: In function '_nss_systemd_getgrnam_r': ../src/nss-systemd/nss-systemd.c:416:32: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess] memzero(buffer, sizeof(char*)); ^~~~ ../src/basic/util.h:118:39: note: in definition of macro 'memzero' #define memzero(x,l) (memset((x), 0, (l))) ^ gcc is trying to be helpful, and it's not far from being right. It _looks_ like sizeof(char*) is an error, but in this case we're really leaving a space empty for a pointer, and our calculation is correct. Since this is a short file, let's just use simplest option and turn off the warning above the two functions that trigger it.
Diffstat (limited to 'src/nss-systemd')
-rw-r--r--src/nss-systemd/nss-systemd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c
index f75405d2e5..c502b5f5fd 100644
--- a/src/nss-systemd/nss-systemd.c
+++ b/src/nss-systemd/nss-systemd.c
@@ -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,