btrfs-progs: fix double file descriptor close in cmd_replace_start()
Reported by 'gcc -fanalyzer': cmds/replace.c:357:17: warning: double ‘close’ of file descriptor ‘fdmnt’ [CWE-1341] [-Wanalyzer-fd-double-close] The first close is done right before going to the label 'leave_with_error' but the variable is not reset to -1 so in the exit block close() is called again. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0e3614e8f9
commit
2bdb838d54
|
@ -199,7 +199,6 @@ static int cmd_replace_start(const struct cmd_struct *cmd,
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
error("unable to check status of exclusive operation: %m");
|
error("unable to check status of exclusive operation: %m");
|
||||||
close(fdmnt);
|
|
||||||
goto leave_with_error;
|
goto leave_with_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue