btrfs-progs: don't double-close prg_fd
authorEric Sandeen <sandeen@redhat.com>
Fri, 25 Jan 2013 00:18:49 +0000 (18:18 -0600)
committerZach Brown <zab@redhat.com>
Wed, 6 Feb 2013 00:09:41 +0000 (16:09 -0800)
If scrub start discovers that scrub is already running,
we need to set prg_fd to -1 before goto out, or we'll
try to close it again in the error path.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Zach Brown <zab@redhat.com>
cmds-scrub.c

index 8655d3d..31ace6d 100644 (file)
@@ -1192,6 +1192,7 @@ static int scrub_start(int argc, char **argv, int resume)
                        /* ... yes, so scrub must be running. error out */
                        fprintf(stderr, "ERROR: scrub already running\n");
                        close(prg_fd);
+                       prg_fd = -1;
                        goto out;
                }
                /*