aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-12-31 16:46:50 -0800
committerGuy Harris <guy@alum.mit.edu>2015-01-01 00:47:17 +0000
commit114e7735b961720e63d2145770ed9b82c0200ff8 (patch)
treef17269993b85673cef4e7ca9f00b4ee5975c77dc
parenta53b67ceb7c1e4b1d53a4853d37386a483cc9ab0 (diff)
Call setlocale() before getting version information.
That way, the setlocale() call used to get the current locale will get the right answer. Change-Id: Ib43e16a9d98d08e5ddaff81fd3235f5b64d7b95b Reviewed-on: https://code.wireshark.org/review/6197 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--capinfos.c6
-rw-r--r--captype.c6
-rw-r--r--rawshark.c6
-rw-r--r--tfshark.c6
-rw-r--r--tshark.c6
5 files changed, 15 insertions, 15 deletions
diff --git a/capinfos.c b/capinfos.c
index 9d4c2ebebe..083a010a09 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -1135,6 +1135,9 @@ main(int argc, char *argv[])
size_t hash_bytes;
#endif
+ /* Set the C-language locale to the native environment. */
+ setlocale(LC_ALL, "");
+
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_capinfos_compiled_info);
@@ -1402,9 +1405,6 @@ main(int argc, char *argv[])
}
}
- /* Set the C-language locale to the native environment. */
- setlocale(LC_ALL, "");
-
if ((argc - optind) < 1) {
print_usage(stderr);
exit(1);
diff --git a/captype.c b/captype.c
index bc09e2d777..53c8f08e93 100644
--- a/captype.c
+++ b/captype.c
@@ -139,6 +139,9 @@ main(int argc, char *argv[])
char *init_progfile_dir_error;
#endif
+ /* Set the C-language locale to the native environment. */
+ setlocale(LC_ALL, "");
+
/* Get the compile-time version information string */
comp_info_str = get_compiled_version_info(NULL, get_captype_compiled_info);
@@ -211,9 +214,6 @@ main(int argc, char *argv[])
}
}
- /* Set the C-language locale to the native environment. */
- setlocale(LC_ALL, "");
-
if (argc < 2) {
print_usage(stderr);
return 1;
diff --git a/rawshark.c b/rawshark.c
index 8859054053..5bbdaa04d9 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -450,6 +450,9 @@ main(int argc, char *argv[])
static const char optstring[] = OPTSTRING_INIT;
+ /* Set the C-language locale to the native environment. */
+ setlocale(LC_ALL, "");
+
cmdarg_err_init(rawshark_cmdarg_err, rawshark_cmdarg_err_cont);
/* Get the compile-time version information string */
@@ -530,9 +533,6 @@ main(int argc, char *argv[])
case any dissectors register preferences. */
epan_init(register_all_protocols, register_all_protocol_handoffs, NULL, NULL);
- /* Set the C-language locale to the native environment. */
- setlocale(LC_ALL, "");
-
prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);
if (gpf_path != NULL) {
diff --git a/tfshark.c b/tfshark.c
index b0fd8aa553..8b1b43a23f 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -814,6 +814,9 @@ main(int argc, char *argv[])
static const char optstring[] = OPTSTRING;
+ /* Set the C-language locale to the native environment. */
+ setlocale(LC_ALL, "");
+
cmdarg_err_init(failure_message, failure_message_cont);
#ifdef _WIN32
@@ -1029,9 +1032,6 @@ main(int argc, char *argv[])
return 0;
}
- /* Set the C-language locale to the native environment. */
- setlocale(LC_ALL, "");
-
prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);
if (gpf_path != NULL) {
diff --git a/tshark.c b/tshark.c
index 928f8d4337..053a06fb53 100644
--- a/tshark.c
+++ b/tshark.c
@@ -1016,6 +1016,9 @@ main(int argc, char *argv[])
static const char optstring[] = OPTSTRING;
+ /* Set the C-language locale to the native environment. */
+ setlocale(LC_ALL, "");
+
cmdarg_err_init(failure_message, failure_message_cont);
#ifdef _WIN32
@@ -1261,9 +1264,6 @@ main(int argc, char *argv[])
return 0;
}
- /* Set the C-language locale to the native environment. */
- setlocale(LC_ALL, "");
-
prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);
if (gpf_path != NULL) {