iscsi-scstd: replace signal() with sigaction()

Replace signal() with sigaction() for validity in a multithreaded process

Signed-off-by: David Butterfield <dab21774@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7139 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2017-04-21 01:02:25 +00:00
parent a8336afa4c
commit 344387c40e

View File

@@ -846,8 +846,13 @@ int main(int argc, char **argv)
/*
* Otherwise we could die in some later write() during the event_loop()
* instead of getting EPIPE!
*
* The effects of signal(2) in a multithreaded process are unspecified,
* so use sigaction(2) instead.
*/
signal(SIGPIPE, SIG_IGN);
struct sigaction act = (struct sigaction) { .sa_handler = SIG_IGN };
int rc = sigaction(SIGPIPE, &act, NULL);
assert(rc == 0);
while ((ch = getopt_long(argc, argv, "c:fd:s:u:g:a:p:vh", long_options, &longindex)) >= 0) {
switch (ch) {