From 71ed758c72db36234209428fa54be82fe8f0899a Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 6 Jun 2014 16:46:15 +1000 Subject: ctdb-daemon: Remove duplicate code from helper binaries Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/Makefile.in | 11 +++++++---- ctdb/server/ctdb_event_helper.c | 12 +----------- ctdb/server/ctdb_lock_helper.c | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/ctdb/Makefile.in b/ctdb/Makefile.in index 7222fc4e9b9..f7d45ecf194 100755 --- a/ctdb/Makefile.in +++ b/ctdb/Makefile.in @@ -180,13 +180,16 @@ bin/ltdbtool: tools/ltdbtool.o $(TDB_OBJ) @echo Linking $@ $(WRAPPER) $(CC) $(CFLAGS) -o $@ $+ $(TDB_LIBS) $(LIB_FLAGS) -bin/ctdb_lock_helper: server/ctdb_lock_helper.o lib/util/util_file.o $(CTDB_EXTERNAL_OBJ) +HELPER_COMMON_OBJ = common/system_util.o common/ctdb_logging.o \ + lib/util/debug.o lib/util/util_time.o lib/util/util_file.o + +bin/ctdb_lock_helper: server/ctdb_lock_helper.o $(HELPER_COMMON_OBJ) $(CTDB_EXTERNAL_OBJ) @echo Linking $@ - $(WRAPPER) $(CC) $(CFLAGS) -o $@ server/ctdb_lock_helper.o lib/util/util_file.o $(CTDB_EXTERNAL_OBJ) $(TDB_LIBS) $(LIB_FLAGS) + $(WRAPPER) $(CC) $(CFLAGS) -o $@ server/ctdb_lock_helper.o $(HELPER_COMMON_OBJ) $(CTDB_EXTERNAL_OBJ) $(LIB_FLAGS) -bin/ctdb_event_helper: server/ctdb_event_helper.o $(REPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) +bin/ctdb_event_helper: server/ctdb_event_helper.o $(HELPER_COMMON_OBJ) $(CTDB_EXTERNAL_OBJ) @echo Linking $@ - $(WRAPPER) $(CC) $(CFLAGS) -o $@ server/ctdb_event_helper.o $(REPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(LIB_FLAGS) + $(WRAPPER) $(CC) $(CFLAGS) -o $@ server/ctdb_event_helper.o $(HELPER_COMMON_OBJ) $(CTDB_EXTERNAL_OBJ) $(LIB_FLAGS) bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o utils/smnotify/smnotify.o $(POPT_OBJ) @echo Linking $@ diff --git a/ctdb/server/ctdb_event_helper.c b/ctdb/server/ctdb_event_helper.c index ab1eae44091..be36b0b72a9 100644 --- a/ctdb/server/ctdb_event_helper.c +++ b/ctdb/server/ctdb_event_helper.c @@ -19,6 +19,7 @@ #include "includes.h" #include "system/filesys.h" +#include "ctdb_private.h" static char *progname = NULL; @@ -38,17 +39,6 @@ static void sigterm(int sig) _exit(0); } -static void set_close_on_exec(int fd) -{ - int v; - - v = fcntl(fd, F_GETFD, 0); - if (v == -1) { - return; - } - fcntl(fd, F_SETFD, v | FD_CLOEXEC); -} - static int check_executable(const char *path) { struct stat st; diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c index d8a1d249b75..b1515a256e1 100644 --- a/ctdb/server/ctdb_lock_helper.c +++ b/ctdb/server/ctdb_lock_helper.c @@ -20,7 +20,7 @@ #include "includes.h" #include "tdb.h" #include "system/filesys.h" -#include "../include/ctdb_private.h" +#include "ctdb_private.h" static char *progname = NULL; -- cgit