temp fix to crashing under gdb in osx

This commit is contained in:
espes 2012-12-07 18:38:04 +11:00
parent c56c8d47cd
commit b130179908
1 changed files with 13 additions and 6 deletions

View File

@ -42,6 +42,7 @@ static void sigfd_handler(void *opaque)
struct qemu_signalfd_siginfo info; struct qemu_signalfd_siginfo info;
struct sigaction action; struct sigaction action;
ssize_t len; ssize_t len;
int err;
while (1) { while (1) {
do { do {
@ -57,12 +58,18 @@ static void sigfd_handler(void *opaque)
return; return;
} }
sigaction(info.ssi_signo, NULL, &action); err = sigaction(info.ssi_signo, NULL, &action);
if ((action.sa_flags & SA_SIGINFO) && action.sa_sigaction) { if (err == 0) {
action.sa_sigaction(info.ssi_signo, if ((action.sa_flags & SA_SIGINFO) && action.sa_sigaction) {
(siginfo_t *)&info, NULL); action.sa_sigaction(info.ssi_signo,
} else if (action.sa_handler) { (siginfo_t *)&info, NULL);
action.sa_handler(info.ssi_signo); } else if (action.sa_handler) {
action.sa_handler(info.ssi_signo);
}
} else {
fprintf(stderr, "sigfd (%s) fail. errno: %d %s\n",
strsignal(info.ssi_signo),
errno, strerror(errno));
} }
} }
} }