]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
flock: fix sizeof usage [clang -Wsizeof-pointer-memaccess]
authorKarel Zak <kzak@redhat.com>
Thu, 19 Jan 2012 18:30:31 +0000 (19:30 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 19 Jan 2012 18:30:31 +0000 (19:30 +0100)
flock.c:90:23: warning: argument to 'sizeof' in 'memset' call is the
same expression as the destination; did you mean to dereference it?
      [-Wsizeof-pointer-memaccess]
        memset(sa, 0, sizeof sa);
               ~~            ^~

Reported-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/flock.c

index 0d4a8fbf5e1409e6d76bf04d5b9126b4a15f59b6..50cea13920ca045b12275351ef95d08a5986fe96 100644 (file)
@@ -87,7 +87,7 @@ static void strtotimeval(const char *str, struct timeval *tv)
 static void setup_timer(struct itimerval *timer, struct itimerval *old_timer,
                        struct sigaction *sa, struct sigaction *old_sa)
 {
-       memset(sa, 0, sizeof sa);
+       memset(sa, 0, sizeof *sa);
        sa->sa_handler = timeout_handler;
        sa->sa_flags = SA_RESETHAND;
        sigaction(SIGALRM, sa, old_sa);