From b80976b7f822c8a502720178d8686aca21532add Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Fri, 5 Oct 2018 08:11:31 +0900 Subject: [PATCH] assgin return value to unused variable to avoid build warning message --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 9757464..c7e28e8 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -121,36 +121,39 @@ static void setEnvFromFile() } } +#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() -- 2.7.4