summaryrefslogtreecommitdiff
path: root/cmds-send.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-01-30 01:11:46 -0600
committerZach Brown <zab@redhat.com>2013-02-05 16:09:41 -0800
commit2986545ccd655273658e0e4463a669bb1893ba68 (patch)
treea5b07783af073cee59b1cea8e36e56414117f8ca /cmds-send.c
parent899ba61fa695ae8e58599da25d174afa392fd552 (diff)
downloadbtrfs-progs-2986545ccd655273658e0e4463a669bb1893ba68.tar.gz
btrfs-progs-2986545ccd655273658e0e4463a669bb1893ba68.tar.bz2
btrfs-progs-2986545ccd655273658e0e4463a669bb1893ba68.zip
btrfs-progs: initialize pipefd[] for error path
Several goto out; paths will end up doing i.e. if (pipefd[0]) close(pipefd[0]); but we get there with uninitialized values in many cases. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'cmds-send.c')
-rw-r--r--cmds-send.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmds-send.c b/cmds-send.c
index 69e9bcea..b2a340e0 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -245,7 +245,7 @@ static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root_id)
struct subvol_info *si;
void *t_err = NULL;
int subvol_fd = -1;
- int pipefd[2];
+ int pipefd[2] = {-1, -1};
si = subvol_uuid_search(&send->sus, root_id, NULL, 0, NULL,
subvol_search_by_root_id);
@@ -327,9 +327,9 @@ static int do_send(struct btrfs_send *send, u64 root_id, u64 parent_root_id)
out:
if (subvol_fd != -1)
close(subvol_fd);
- if (pipefd[0])
+ if (pipefd[0] != -1)
close(pipefd[0]);
- if (pipefd[1])
+ if (pipefd[1] != -1)
close(pipefd[1]);
return ret;
}