projects
/
platform
/
upstream
/
btrfs-progs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cb4c601
)
btrfs-progs: scrub can leak fd 0
author
Zach Brown
<zab@redhat.com>
Wed, 23 Jan 2013 22:41:03 +0000
(14:41 -0800)
committer
Zach Brown
<zab@redhat.com>
Wed, 6 Feb 2013 00:09:40 +0000
(16:09 -0800)
< 0 is returned for errors opening the file, this code could leak fd 0.
Signed-off-by: Zach Brown <zab@redhat.com>
cmds-scrub.c
patch
|
blob
|
history
diff --git
a/cmds-scrub.c
b/cmds-scrub.c
index
70d2683
..
8655d3d
100644
(file)
--- a/
cmds-scrub.c
+++ b/
cmds-scrub.c
@@
-754,7
+754,7
@@
static int scrub_write_progress(pthread_mutex_t *m, const char *fsid,
{
int ret;
int err;
- int fd =
0
;
+ int fd =
-1
;
int old;
ret = pthread_mutex_lock(m);
@@
-782,7
+782,7
@@
static int scrub_write_progress(pthread_mutex_t *m, const char *fsid,
goto out;
out:
- if (fd > 0) {
+ if (fd >
=
0) {
ret = close(fd);
if (ret)
err = -errno;