Skip to contentSkip to conversation

dmsetup: return non-zero on stdio I/O error

PATCH New Demi Marie Obenour 1 participant 1 message Apr 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dmsetup: return non-zero on stdio I/O error

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(+)
libdm/dm-tools/dmsetup.c +2 -0
index d01b8f2..0449e40 100644
@@ -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;
 }
Signature · 3 lines
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab

_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/