[linux-lvm] [PATCH 1/3] dmsetup: return non-zero on stdio I/O error

Demi Marie Obenour demi at invisiblethingslab.com
Mon Apr 4 21:58:08 UTC 2022


If there is an I/O error on stdout, return a non-zero status so that
udev can avoid trusting the values printed.  Deeper changes to the
log code are out of scope for this patch.
---
 libdm/dm-tools/dmsetup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index d01b8f2..0449e40 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -7491,5 +7491,7 @@ out:
 	if (_initial_timestamp)
 		dm_timestamp_destroy(_initial_timestamp);
 
+        if (fflush(stdout) || ferror(stdout))
+            return 1;
 	return (_switches[HELP_ARG] || _switches[VERSION_ARG]) ? 0 : ret;
 }
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20220404/d58760eb/attachment-0001.sig>


More information about the linux-lvm mailing list