}
}
+#define _unused(x) ((void)(x))
+
struct sigaction sig_abrt_new;
struct sigaction sig_abrt_old;
static bool checkOnSigabrt = false;
+
static void onSigabrt(int signum)
{
- // ignore return value of write().
- // this function is called when process go to die
- // there is no need to handle return value for logging.
- write(2, "onSigabrt called\n", 17);
+ // use unused variable to avoid build warning
+ ssize_t ret = write(STDERR_FILENO, "onSigabrt called\n", 17);
if (checkOnSigabrt) {
- write(2, "onSigabrt called again. go to exit\n", 35);
+ ret = write(STDERR_FILENO, "onSigabrt called again. go to exit\n", 35);
+ _unused(ret);
exit(0);
}
if (hasException()) {
- write(2, "******************************************************\n", 55);
- write(2, "Unhandled exception is occured. check application code\n", 55);
- write(2, "******************************************************\n", 55);
+ ret = write(STDERR_FILENO, "******************************************************\n", 55);
+ ret = write(STDERR_FILENO, "Unhandled exception is occured. check application code\n", 55);
+ ret = write(STDERR_FILENO, "******************************************************\n", 55);
}
checkOnSigabrt = true;
if (sigaction(SIGABRT, &sig_abrt_old, NULL) == 0) {
if (raise(signum) < 0) {
- write(2, "Fail to raise SIGABRT\n", 22);
+ ret = write(STDERR_FILENO, "Fail to raise SIGABRT\n", 22);
}
} else {
- write(2, "Fail to set original SIGABRT handler\n", 37);
+ ret = write(STDERR_FILENO, "Fail to set original SIGABRT handler\n", 37);
}
+ _unused(ret);
}
static void registerSigHandler()