summaryrefslogtreecommitdiff
path: root/wsutil
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2016-07-23 03:52:10 +0100
committerMichael Mann <mmann78@netscape.net>2016-07-23 12:44:34 +0000
commita02e90da41a92baf909865e2361fb6701d0a8432 (patch)
treedf447254a177617fa868fc409009f5cae9a898fc /wsutil
parentc9329ff0ec9c6ade928100564e7c04f1e11125df (diff)
downloadwireshark-a02e90da41a92baf909865e2361fb6701d0a8432.tar.gz
filesystem.c: Don't constify mallocated pointer
Change-Id: I8991682bda256c5e1c09a303b0243e240b276101 Reviewed-on: https://code.wireshark.org/review/16602 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/filesystem.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index 44cd026f6d..989070305e 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -940,7 +940,7 @@ get_datafile_dir(void)
* of the plugin directory, so it can just fetch the plugins built
* as part of the build process.
*/
-static const char *plugin_dir = NULL;
+static char *plugin_dir = NULL;
static void
init_plugin_dir(void)
@@ -954,8 +954,7 @@ init_plugin_dir(void)
* on Windows, the data file directory is the directory
* in which the Wireshark binary resides.
*/
- plugin_dir = g_strdup_printf("%s\\plugins\\%s", get_datafile_dir(),
- VERSION);
+ plugin_dir = g_build_filename(get_datafile_dir(), "plugins", VERSION, (gchar *)NULL);
/*
* Make sure that pathname refers to a directory.
@@ -974,8 +973,8 @@ init_plugin_dir(void)
* scanner will check all subdirectories of that
* directory for plugins.
*/
- g_free( (gpointer) plugin_dir);
- plugin_dir = g_strdup_printf("%s\\plugins", get_datafile_dir());
+ g_free(plugin_dir);
+ plugin_dir = g_build_filename(get_datafile_dir(), "plugins", (gchar *)NULL);
running_in_build_directory_flag = TRUE;
}
#else
@@ -986,7 +985,7 @@ init_plugin_dir(void)
* the "plugins" subdirectory of the directory where the program
* we're running is (that's the build directory).
*/
- plugin_dir = g_strdup_printf("%s/plugins", get_progfile_dir());
+ plugin_dir = g_build_filename(get_progfile_dir(), "plugins", (gchar *)NULL);
} else {
if (g_getenv("WIRESHARK_PLUGIN_DIR") && !started_with_special_privs()) {
/*
@@ -1006,12 +1005,11 @@ init_plugin_dir(void)
* it; we don't need to call started_with_special_privs().)
*/
else if (appbundle_dir != NULL) {
- plugin_dir = g_strdup_printf("%s/Contents/PlugIns/wireshark",
- appbundle_dir);
+ plugin_dir = g_build_filename(appbundle_dir, "Contents/PlugIns/wireshark", (gchar *)NULL);
}
#endif
else {
- plugin_dir = PLUGIN_INSTALL_DIR;
+ plugin_dir = g_strdup(PLUGIN_INSTALL_DIR);
}
}
#endif
@@ -1051,7 +1049,7 @@ get_plugin_dir(void)
* of the extcap directory, so it can just fetch the extcap hooks built
* as part of the build process.
*/
-static const char *extcap_dir = NULL;
+static char *extcap_dir = NULL;
static void init_extcap_dir(void) {
#ifdef _WIN32
@@ -1072,7 +1070,7 @@ static void init_extcap_dir(void) {
*/
extcap_dir = g_strdup(alt_extcap_path);
} else {
- extcap_dir = g_strdup_printf("%s\\extcap", get_datafile_dir());
+ extcap_dir = g_build_filename(get_datafile_dir(), "extcap", (gchar *)NULL);
}
#else
if (running_in_build_directory_flag) {
@@ -1082,7 +1080,7 @@ static void init_extcap_dir(void) {
* the "extcap hooks" subdirectory of the directory where the program
* we're running is (that's the build directory).
*/
- extcap_dir = g_strdup_printf("%s/extcap", get_progfile_dir());
+ extcap_dir = g_build_filename(get_progfile_dir(), "extcap", (gchar *)NULL);
} else {
if (g_getenv("WIRESHARK_EXTCAP_DIR") && !started_with_special_privs()) {
/*
@@ -1102,12 +1100,11 @@ static void init_extcap_dir(void) {
* it; we don't need to call started_with_special_privs().)
*/
else if (appbundle_dir != NULL) {
- extcap_dir = g_strdup_printf("%s/Contents/MacOS/extcap",
- appbundle_dir);
+ extcap_dir = g_build_filename(appbundle_dir, "Contents/MacOS/extcap", (gchar *)NULL);
}
#endif
else {
- extcap_dir = EXTCAP_DIR;
+ extcap_dir = g_strdup(EXTCAP_DIR);
}
}
#endif