]> git.tuebingen.mpg.de Git - dss.git/commit
Improve signal handler.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 25 Feb 2015 10:15:33 +0000 (11:15 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 25 Feb 2015 10:39:48 +0000 (11:39 +0100)
commit612d4cad3e8007c4c8a70181a8bc66730ae3a972
tree0fe65ad1e36ee149627848ec1ed742e36721f866
parent75958eeeb542bea34efe72c61501227036ea9626
Improve signal handler.

The signal handler of dss has two issues: (a) it does not check the
return value of the write(2) call, and (b) it does not restore errno
on exit. The second issue might cause problems on systems where
write(2) sets errno also on success. Those problems would be very
hard to reproduce and debug. So it is probably a good idea to be
conservative here.

This commit fixes (a) by printing an error message and calling exit(3)
if the write to the signal pipe failed or resulted in a short write.
As for (b), we now save a copy of errno before the write(2) call,
and restore the old value on success.
sig.c