]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
flock: properly report exec() errors
authorKarel Zak <kzak@redhat.com>
Fri, 20 Aug 2010 09:45:00 +0000 (11:45 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 20 Aug 2010 09:45:00 +0000 (11:45 +0200)
Reported-by: Barry Davis <barry_davis@stormagic.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/flock.c

index 1f1c563b124ecea2e93d50a70eef36087128a103..20004caedb0f397a571ddf57bd94ec7995b2ea50 100644 (file)
@@ -298,8 +298,8 @@ int main(int argc, char *argv[])
     } else if ( f == 0 ) {
       if ( do_close )
        close(fd);
-      err = errno;
       execvp(cmd_argv[0], cmd_argv);
+      err = errno;
       /* execvp() failed */
       fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err));
       _exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE);