Skip to content

Commit

Permalink
scan-scsi-target: Close FD in error path
Browse files Browse the repository at this point in the history
Code scanning tools show this as a FD leak even though in this case
it doesn't matter as the utility is exiting soon.

Signed-off-by: Tony Asleson <[email protected]>
  • Loading branch information
tasleson committed May 10, 2024
1 parent b385829 commit 268465a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/udev/scan-scsi-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ int main(int argc, char **argv) {
usage(argv, 1);
}
if (write(fd, sysfs_data, strlen(sysfs_data)) < 0) {
close(fd);
fprintf(stderr, "Cannot write '%s': %s\n", sysfs_path, strerror(errno));
usage(argv, 1);
}
Expand Down

0 comments on commit 268465a

Please sign in to comment.