core: Prefer EXIT_FAILURE.
This commit is contained in:
18
src/main.c
18
src/main.c
@@ -1578,28 +1578,28 @@ static void _shed_privileges()
|
|||||||
if (setrlimit(RLIMIT_FSIZE, &zeroLimit) != 0)
|
if (setrlimit(RLIMIT_FSIZE, &zeroLimit) != 0)
|
||||||
{
|
{
|
||||||
perror("setrlimit(RLIMIT_FSIZE, {0, 0})");
|
perror("setrlimit(RLIMIT_FSIZE, {0, 0})");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (setrlimit(RLIMIT_NOFILE, &zeroLimit) != 0)
|
if (setrlimit(RLIMIT_NOFILE, &zeroLimit) != 0)
|
||||||
{
|
{
|
||||||
perror("setrlimit(RLIMIT_NOFILE, {0, 0})");
|
perror("setrlimit(RLIMIT_NOFILE, {0, 0})");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (setrlimit(RLIMIT_NPROC, &zeroLimit) != 0)
|
if (setrlimit(RLIMIT_NPROC, &zeroLimit) != 0)
|
||||||
{
|
{
|
||||||
perror("setrlimit(RLIMIT_NPROC, {0, 0})");
|
perror("setrlimit(RLIMIT_NPROC, {0, 0})");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#if !defined(__MACH__) && !defined(__OpenBSD__)
|
#if !defined(__MACH__) && !defined(__OpenBSD__)
|
||||||
if (setrlimit(RLIMIT_LOCKS, &zeroLimit) != 0)
|
if (setrlimit(RLIMIT_LOCKS, &zeroLimit) != 0)
|
||||||
{
|
{
|
||||||
perror("setrlimit(RLIMIT_LOCKS, {0, 0})");
|
perror("setrlimit(RLIMIT_LOCKS, {0, 0})");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (setrlimit(RLIMIT_MSGQUEUE, &zeroLimit) != 0)
|
if (setrlimit(RLIMIT_MSGQUEUE, &zeroLimit) != 0)
|
||||||
{
|
{
|
||||||
perror("setrlimit(RLIMIT_MSGQUEUE, {0, 0})");
|
perror("setrlimit(RLIMIT_MSGQUEUE, {0, 0})");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1609,12 +1609,12 @@ static void _shed_privileges()
|
|||||||
if (unveil("/dev/null", "r") || unveil(NULL, NULL))
|
if (unveil("/dev/null", "r") || unveil(NULL, NULL))
|
||||||
{
|
{
|
||||||
perror("unveil");
|
perror("unveil");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (pledge("stdio unveil", NULL))
|
if (pledge("stdio unveil", NULL))
|
||||||
{
|
{
|
||||||
perror("pledge");
|
perror("pledge");
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1831,7 +1831,7 @@ static void _error_handler(int sig)
|
|||||||
const char* stack = tf_util_backtrace_string();
|
const char* stack = tf_util_backtrace_string();
|
||||||
tf_printf("ERROR:\n%s\n", stack);
|
tf_printf("ERROR:\n%s\n", stack);
|
||||||
tf_free((void*)stack);
|
tf_free((void*)stack);
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@@ -1843,7 +1843,7 @@ static LONG WINAPI _win32_exception_handler(EXCEPTION_POINTERS* info)
|
|||||||
const char* stack = tf_util_backtrace_string();
|
const char* stack = tf_util_backtrace_string();
|
||||||
tf_printf("ERROR:\n%s\n", stack);
|
tf_printf("ERROR:\n%s\n", stack);
|
||||||
tf_free((void*)stack);
|
tf_free((void*)stack);
|
||||||
_exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
@@ -1101,7 +1101,7 @@ void tf_task_on_receive_packet(int packetType, const char* begin, size_t length,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kSetImports:
|
case kSetImports:
|
||||||
@@ -1699,7 +1699,7 @@ void tf_task_activate(tf_task_t* task)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
tf_printf("Assignment missing '=': %s.\n", assignment);
|
tf_printf("Assignment missing '=': %s.\n", assignment);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tf_free(copy);
|
tf_free(copy);
|
||||||
|
Reference in New Issue
Block a user