diff options
author | Greg KH <gregkh@linuxfoundation.org> | 2014-01-31 06:51:32 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-01-31 11:55:01 +0100 |
commit | 29804cc1e0f37ee34301530fd7f1eb8550be464e (patch) | |
tree | ba287b984b216279bb342579a9d1039383ca3a39 /src/libsystemd-daemon/sd-daemon.c | |
parent | b5cfa7408c4cb68e9bb232fc34b07fd03c915617 (diff) |
use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set). So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
Diffstat (limited to 'src/libsystemd-daemon/sd-daemon.c')
-rw-r--r-- | src/libsystemd-daemon/sd-daemon.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsystemd-daemon/sd-daemon.c b/src/libsystemd-daemon/sd-daemon.c index 94230c9ed6..1a713ef2e8 100644 --- a/src/libsystemd-daemon/sd-daemon.c +++ b/src/libsystemd-daemon/sd-daemon.c @@ -47,6 +47,7 @@ # include <mqueue.h> #endif +#include "util.h" #include "sd-daemon.h" #if (__GNUC__ >= 4) @@ -441,18 +442,18 @@ _sd_export_ int sd_notify(int unset_environment, const char *state) { goto finish; } - memset(&sockaddr, 0, sizeof(sockaddr)); + memzero(&sockaddr, sizeof(sockaddr)); sockaddr.sa.sa_family = AF_UNIX; strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); if (sockaddr.un.sun_path[0] == '@') sockaddr.un.sun_path[0] = 0; - memset(&iovec, 0, sizeof(iovec)); + memzero(&iovec, sizeof(iovec)); iovec.iov_base = (char*) state; iovec.iov_len = strlen(state); - memset(&msghdr, 0, sizeof(msghdr)); + memzero(&msghdr, sizeof(msghdr)); msghdr.msg_name = &sockaddr; msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e); |