mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
FS-7088 #resolve Set flag to enable core dump from non-root users.
When FreeSWITCH is running as a non-privileged user, we need to enable PR_SET_DUMPABLE for it to be able to generate core dumps. Instead of a generic __linux__ check, there's a new configure.ac flag to check directly for prctl.h, which could also be used in other places in the code.
This commit is contained in:
@@ -51,6 +51,9 @@
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <sqlite3.h>
|
||||
#ifdef HAVE_SYS_PRCTL_H
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
|
||||
SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs = { 0 };
|
||||
@@ -1029,6 +1032,12 @@ SWITCH_DECLARE(int32_t) change_user_group(const char *user, const char *group)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to change uid!\n");
|
||||
return -1;
|
||||
}
|
||||
#ifdef HAVE_SYS_PRCTL_H
|
||||
if (prctl(PR_SET_DUMPABLE, 1) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to enable core dumps!\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user