From 956b78e8e3636bbf04e264ca96128edc2cbf3626 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 16 Jun 2011 08:51:14 +0200 Subject: [PATCH] sd-daemon: remove unnecessary memset calls There is no point in clearing the bits of a "struct stat" when the very next statement just calls stat or fstat to fill in that same memory. [zj: two more places] --- src/core/load-fragment.c | 1 - src/core/service.c | 1 - src/libsystemd-daemon/sd-daemon.c | 2 -- 3 files changed, 4 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 7fcd63a17..bbd82b9d2 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2287,7 +2287,6 @@ static int load_from_path(Unit *u, const char *path) { goto finish; } - zero(st); if (fstat(fileno(f), &st) < 0) { r = -errno; goto finish; diff --git a/src/core/service.c b/src/core/service.c index 30598de9b..1c127bdbc 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -564,7 +564,6 @@ static int service_load_sysv_path(Service *s, const char *path) { goto finish; } - zero(st); if (fstat(fileno(f), &st) < 0) { r = -errno; goto finish; diff --git a/src/libsystemd-daemon/sd-daemon.c b/src/libsystemd-daemon/sd-daemon.c index 763e079b4..863ac7529 100644 --- a/src/libsystemd-daemon/sd-daemon.c +++ b/src/libsystemd-daemon/sd-daemon.c @@ -152,7 +152,6 @@ _sd_export_ int sd_is_fifo(int fd, const char *path) { if (fd < 0) return -EINVAL; - memset(&st_fd, 0, sizeof(st_fd)); if (fstat(fd, &st_fd) < 0) return -errno; @@ -162,7 +161,6 @@ _sd_export_ int sd_is_fifo(int fd, const char *path) { if (path) { struct stat st_path; - memset(&st_path, 0, sizeof(st_path)); if (stat(path, &st_path) < 0) { if (errno == ENOENT || errno == ENOTDIR) -- 2.30.2