mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
tools/firewire: nosy-dump: guard close(fd) when reading from input file
The file descriptor fd is initialized to -1 and only opened via open() when the --input option is not used. However, close(fd) is called unconditionally at the end of main(), which results in close(-1) and a spurious EBADF error when nosy-dump reads from an input file. Guard the close() call with "if (fd >= 0)" to match the existing conditional cleanup pattern used for the output file handle. Signed-off-by: longlong yan <yanlonglong@kylinos.cn> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
parent
c03c1a1450
commit
efc4506664
|
|
@ -1014,7 +1014,8 @@ int main(int argc, const char *argv[])
|
|||
if (output != NULL)
|
||||
fclose(output);
|
||||
|
||||
close(fd);
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
poptFreeContext(con);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user