]> git.ipfire.org Git - thirdparty/dracut.git/commit
fix(skipcpio): ignore broken pipe
authorDavid Tardon <dtardon@redhat.com>
Tue, 16 Aug 2022 11:30:16 +0000 (13:30 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Thu, 18 Aug 2022 06:08:45 +0000 (06:08 +0000)
commitaa0369a4a31764fde06214358b0774fb1095af01
treefd9d6b0b8b15e8f441e334a1fc786edd6340e381
parentbdef7793ba2a41f8f62ec674b852e96a85e96207
fix(skipcpio): ignore broken pipe

If lsinitrd is called from a context in which SIGPIPE is ignored (e.g.,
from a systemd unit with default setting of IgnoreSIGPIPE=), the
following line will result in an error being issued:

bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"

An example error from `kdumpctl start` (which internally just calls
`systemctl start kdump.service`):

kdumpctl[1287]: ERROR: src/skipcpio/skipcpio.c:191:main(): fwrite

A minimal reproducer:

systemd-run -t sh -c '/path/to/skipcpio /path/to/any/file | false'
src/skipcpio/skipcpio.c