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.

>From 587cd9b7ab9c9095e84fe31df4d5b4cd8b2649bf Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 16 Jun 2011 08:43:48 +0200
Subject: [PATCH] systemctl: sd_is_fifo: remove unnecessary memset calls

---
 src/sd-daemon.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/sd-daemon.c b/src/sd-daemon.c
index d9f23d6..5668390 100644
--- a/src/sd-daemon.c
+++ b/src/sd-daemon.c
@@ -142,7 +142,6 @@ _sd_hidden_ 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;

@@ -152,7 +151,6 @@ _sd_hidden_ 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)
--
1.7.6.rc0.293.g40857
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to