mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdb-tests: Avoid segfault by initializing logging
Setting DEBUGLEVEL before calling debug_init() causes segmentation violation with gcc8. DEBUGLEVEL_CLASS is statically initialized to debug_class_list_initial which is defined as const. Only after debug_init() is called, DEBUGLEVEL_CLASS becomes a talloc'd array. So before modifying DEBUGLEVEL, ensure debug_init() is called via setup_logging(). (debug_init is a static function.) Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
b977ded38a
commit
af69700853
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "client/client.h"
|
||||
@ -230,6 +231,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("fetch_loop", DEBUG_STDERR);
|
||||
|
||||
status = process_options_basic(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "client/client.h"
|
||||
@ -155,6 +156,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("fetch_loop_key", DEBUG_STDERR);
|
||||
|
||||
status = process_options_database(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "client/client.h"
|
||||
@ -107,6 +108,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("fetch_readonly", DEBUG_STDERR);
|
||||
|
||||
status = process_options_database(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "client/client.h"
|
||||
@ -214,6 +215,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("fetch_readonly_loop", DEBUG_STDERR);
|
||||
|
||||
status = process_options_basic(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/time.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
@ -331,6 +332,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("fetch_ring", DEBUG_STDERR);
|
||||
|
||||
status = process_options_basic(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -213,6 +213,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("glock_loop", DEBUG_STDERR);
|
||||
|
||||
status = process_options_basic(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
@ -230,8 +232,6 @@ int main(int argc, const char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
setup_logging("glock_loop", DEBUG_STDERR);
|
||||
|
||||
ret = ctdb_client_init(mem_ctx, ev, opts->socket, &client);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Failed to initialize client, ret=%d\n", ret);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/time.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
@ -317,6 +318,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("message_ring", DEBUG_STDERR);
|
||||
|
||||
status = process_options_basic(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "client/client.h"
|
||||
@ -342,6 +343,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("transaction_loop", DEBUG_STDERR);
|
||||
|
||||
status = process_options_database(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "protocol/protocol_private.h"
|
||||
@ -429,6 +430,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("tunnel_test", DEBUG_STDERR);
|
||||
|
||||
status = process_options_basic(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "protocol/protocol_api.h"
|
||||
@ -177,6 +178,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("update_record", DEBUG_STDERR);
|
||||
|
||||
status = process_options_database(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "replace.h"
|
||||
#include "system/network.h"
|
||||
|
||||
#include "lib/util/debug.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
#include "protocol/protocol_api.h"
|
||||
@ -153,6 +154,8 @@ int main(int argc, const char *argv[])
|
||||
int ret;
|
||||
bool status;
|
||||
|
||||
setup_logging("update_record_persistene", DEBUG_STDERR);
|
||||
|
||||
status = process_options_database(argc, argv, &opts);
|
||||
if (! status) {
|
||||
exit(1);
|
||||
|
@ -865,7 +865,7 @@ def build(bld):
|
||||
source=bld.SUBDIR('tests/src',
|
||||
'cluster_wait.c test_options.c'),
|
||||
includes='include',
|
||||
deps='replace popt talloc tevent tdb')
|
||||
deps='samba-util replace popt talloc tevent tdb')
|
||||
|
||||
# Test binaries
|
||||
ctdb_tests = [
|
||||
|
Loading…
Reference in New Issue
Block a user