[Toybox] [PATCH] dd: simplify signal handling and fix status output.

enh enh at google.com
Tue Feb 23 14:28:49 PST 2021


Other dd implementations always show the status on exit, whether success
or failure. Fix that by using xsigatexit() (and clarify the comment for
that function a little, since it didn't previously address the "at exit"
part of its behavior at all).

This also fixes SIGUSR1 behavior so that we show the status immediately
rather than on the next trip round the read/write loop.

Tested with `dd of=/dev/full`, sending SIGUSR1 twice from another shell
(to see the status immediately each time, without exiting), then hitting
^C (to see the status and then exiting), then restarting dd and hitting
enter (to see a write error followed by the status before exiting).

Bug: https://issuetracker.google.com/177017283
---
 lib/lib.c         |  7 ++++---
 toys/pending/dd.c | 18 +++++-------------
 2 files changed, 9 insertions(+), 16 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210223/266ab419/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-dd-simplify-signal-handling-and-fix-status-output.patch
Type: text/x-patch
Size: 3009 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210223/266ab419/attachment.bin>


More information about the Toybox mailing list