Skip to content

Commit

Permalink
dmsetup: return non-zero on stdio I/O error
Browse files Browse the repository at this point in the history
If there is an I/O error on stdout or stderr, return a non-zero status
so that udev can avoid trusting the values printed.
  • Loading branch information
DemiMarie committed Apr 3, 2022
1 parent 8dccc23 commit 0cae942
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libdm/dm-tools/dmsetup.c
Original file line number Diff line number Diff line change
Expand Up @@ -7505,5 +7505,9 @@ int main(int argc, char **argv)
if (_initial_timestamp)
dm_timestamp_destroy(_initial_timestamp);

fflush(stdout);
fflush(stderr);
if (ferror(stdout) || ferror(stderr))
return 1;
return (_switches[HELP_ARG] || _switches[VERSION_ARG]) ? 0 : ret;
}

0 comments on commit 0cae942

Please sign in to comment.