From c8e79533337b817bbb049914de272dcc7034669d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 15 Jun 2014 10:05:28 +0200 Subject: [PATCH] dispatcher/trivial: rename variables for script directory to NMD_SCRIPT_DIR_* --- callouts/nm-dispatcher-api.h | 6 +++--- callouts/nm-dispatcher.c | 6 +++--- src/nm-dispatcher.c | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/callouts/nm-dispatcher-api.h b/callouts/nm-dispatcher-api.h index eb6b33fe0c..03e40f7752 100644 --- a/callouts/nm-dispatcher-api.h +++ b/callouts/nm-dispatcher-api.h @@ -20,9 +20,9 @@ #include -#define NMD_SCRIPT_DIR NMCONFDIR "/dispatcher.d" -#define NMD_PRE_UP_DIR NMD_SCRIPT_DIR "/pre-up.d" -#define NMD_PRE_DOWN_DIR NMD_SCRIPT_DIR "/pre-down.d" +#define NMD_SCRIPT_DIR_DEFAULT NMCONFDIR "/dispatcher.d" +#define NMD_SCRIPT_DIR_PRE_UP NMD_SCRIPT_DIR_DEFAULT "/pre-up.d" +#define NMD_SCRIPT_DIR_PRE_DOWN NMD_SCRIPT_DIR_DEFAULT "/pre-down.d" /* dbus-glib types for dispatcher call return value */ #define DISPATCHER_TYPE_RESULT (dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID)) diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c index 93998225d1..680715d1cd 100644 --- a/callouts/nm-dispatcher.c +++ b/callouts/nm-dispatcher.c @@ -426,12 +426,12 @@ find_scripts (const char *str_action) if ( strcmp (str_action, NMD_ACTION_PRE_UP) == 0 || strcmp (str_action, NMD_ACTION_VPN_PRE_UP) == 0) - dirname = NMD_PRE_UP_DIR; + dirname = NMD_SCRIPT_DIR_PRE_UP; else if ( strcmp (str_action, NMD_ACTION_PRE_DOWN) == 0 || strcmp (str_action, NMD_ACTION_VPN_PRE_DOWN) == 0) - dirname = NMD_PRE_DOWN_DIR; + dirname = NMD_SCRIPT_DIR_PRE_DOWN; else - dirname = NMD_SCRIPT_DIR; + dirname = NMD_SCRIPT_DIR_DEFAULT; if (!(dir = g_dir_open (dirname, 0, &error))) { g_message ("Failed to open dispatcher directory '%s': (%d) %s", diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index 336b91f7ed..2ddbf49000 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -221,7 +221,7 @@ dispatcher_results_process (guint request_id, GPtrArray *results) if (!validate_element (request_id, tmp, G_TYPE_STRING, i, 0)) continue; script = g_value_get_string (tmp); - if (!script || strncmp (script, NMD_SCRIPT_DIR "/", STRLEN (NMD_SCRIPT_DIR "/"))) + if (!script || strncmp (script, NMD_SCRIPT_DIR_DEFAULT "/", STRLEN (NMD_SCRIPT_DIR_DEFAULT "/"))) continue; /* Result */ @@ -240,11 +240,11 @@ dispatcher_results_process (guint request_id, GPtrArray *results) if (result == DISPATCH_RESULT_SUCCESS) { nm_log_dbg (LOGD_DISPATCH, "(%u) %s succeeded", request_id, - script + STRLEN (NMD_SCRIPT_DIR "/")); + script + STRLEN (NMD_SCRIPT_DIR_DEFAULT "/")); } else { nm_log_warn (LOGD_DISPATCH, "(%u) %s failed (%s): %s", request_id, - script + STRLEN (NMD_SCRIPT_DIR "/"), + script + STRLEN (NMD_SCRIPT_DIR_DEFAULT "/"), dispatch_result_to_string (result), err ? err : ""); } @@ -379,7 +379,7 @@ _dispatcher_call (DispatcherAction action, info->user_data = user_data; info->idle_id = g_idle_add (dispatcher_idle_cb, info); } - nm_log_dbg (LOGD_DISPATCH, "(%u) ignoring request; no scripts in " NMD_SCRIPT_DIR, reqid); + nm_log_dbg (LOGD_DISPATCH, "(%u) ignoring request; no scripts in " NMD_SCRIPT_DIR_DEFAULT, reqid); success = TRUE; goto done; } @@ -633,9 +633,9 @@ typedef struct { } Monitor; static Monitor monitors[3] = { - { NMD_SCRIPT_DIR, NULL, TRUE }, - { NMD_PRE_UP_DIR, NULL, TRUE }, - { NMD_PRE_DOWN_DIR, NULL, TRUE } + { NMD_SCRIPT_DIR_DEFAULT, NULL, TRUE }, + { NMD_SCRIPT_DIR_PRE_UP, NULL, TRUE }, + { NMD_SCRIPT_DIR_PRE_DOWN, NULL, TRUE } }; static void