Replace all strerror() with g_strerror().
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 28 Jun 2011 09:00:11 +0000 (09:00 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 28 Jun 2011 09:00:11 +0000 (09:00 +0000)
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37812 f5534014-38df-0310-8fa8-9805f1628bb7

48 files changed:
ConfigureChecks.cmake
alert_box.c
capinfos.c
capture-pcap-util-unix.c
capture_sync.c
cmakeconfig.h.in
color_filters.c
config.h.win32
configure.in
dftest.c
dumpcap.c
epan/dfilter/dfilter-macro.c
epan/diam_dict.l
epan/dissectors/packet-giop.c
epan/dtd_preparse.l
epan/filesystem.c
epan/radius_dict.l
epan/uat.c
epan/uat_load.l
gtk/airpcap_dlg.c
gtk/color_dlg.c
gtk/filter_dlg.c
gtk/follow_stream.c
gtk/follow_tcp.c
gtk/funnel_stat.c
gtk/main.c
gtk/prefs_dlg.c
gtk/print_dlg.c
gtk/profile_dlg.c
gtk/proto_dlg.c
gtk/recent.c
gtk/simple_dialog.c
gtk/text_page_utils.c
mergecap.c
packaging/macosx/native-gtk/config.h
plugins/asn1/packet-asn1.c
plugins/mate/mate_parser.l
randpkt.c
rawshark.c
text2pcap.c
tools/checkAPIs.pl
tshark.c
version_info.c
wiretap/wtap.c
wsutil/CMakeLists.txt
wsutil/Makefile.am
wsutil/strerror.c [deleted file]
wsutil/strerror.h [deleted file]

index d1056affa6bf3819c5bd90fa6e85113821ef9587..198e3fd9c46ac89ea07782b18e8c80c7f702155c 100644 (file)
@@ -25,7 +25,6 @@ check_include_file("stdarg.h"            HAVE_STDARG_H)
 check_include_file("stddef.h"            HAVE_STDDEF_H)\r
 check_include_file("stdint.h"            HAVE_STDINT_H)\r
 check_include_file("stdlib.h"            HAVE_STDLIB_H)\r
-check_include_file("strerror.h"          NEED_STRERROR_H)\r
 check_include_file("strings.h"           HAVE_STRINGS_H)\r
 check_include_file("string.h"            HAVE_STRING_H)\r
 check_include_file("sys/ioctl.h"         HAVE_SYS_IOCTL_H)\r
index 1ac91e2337773f2176b12baf133ff71f0f84d9b2..fd53c84c9f168ab5362d8296dd333e179d0ebba0 100644 (file)
@@ -75,7 +75,7 @@ read_failure_alert_box(const char *filename, int err)
 {
   simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                 "An error occurred while reading from the file \"%s\": %s.",
-                filename, strerror(err));
+                filename, g_strerror(err));
 }
 
 /*
index 88af0b5237d253ccc7cbf734ef66c4f5940b1f7d..40f75ff578cc8cdf1f1f7022bcd4cd06e185f756 100644 (file)
@@ -676,7 +676,7 @@ process_cap_file(wtap *wth, const char *filename)
   if (size == -1) {
     fprintf(stderr,
             "capinfos: Can't get size of \"%s\": %s.\n",
-            filename, strerror(err));
+            filename, g_strerror(err));
     g_free(cf_info.encap_counts);
     return 1;
   }
index 3ffda24fac59d7047e9ba47d38a7cf1ef1b534dd..6ea083cefdb6e7f5f6bfa325c6c3fd94e9fee3c0 100644 (file)
@@ -127,7 +127,7 @@ get_interface_list(int *err, char **err_str)
                if (err_str != NULL) {
                        *err_str = g_strdup_printf(
                            "Can't get list of interfaces: error opening socket: %s",
-                           strerror(errno));
+                           g_strerror(errno));
                }
                return NULL;
        }
@@ -148,7 +148,7 @@ get_interface_list(int *err, char **err_str)
                                if (err_str != NULL) {
                                        *err_str = g_strdup_printf(
                                            "Can't get list of interfaces: SIOCGIFCONF ioctl error: %s",
-                                           strerror(errno));
+                                           g_strerror(errno));
                                }
                                goto fail;
                        }
@@ -206,7 +206,7 @@ get_interface_list(int *err, char **err_str)
                        if (err_str != NULL) {
                                *err_str = g_strdup_printf(
                                    "Can't get list of interfaces: SIOCGIFFLAGS error getting flags for interface %s: %s",
-                                   ifr->ifr_name, strerror(errno));
+                                   ifr->ifr_name, g_strerror(errno));
                        }
                        goto fail;
                }
index addb714b7bbc052d6a60911cbe8246c740056064..026f6faa9d327355ddeede5c91747073d19ed609 100644 (file)
@@ -595,7 +595,7 @@ sync_pipe_start(capture_options *capture_opts) {
 #else /* _WIN32 */
     if (pipe(sync_pipe) < 0) {
         /* Couldn't create the pipe between parent and child. */
-        report_failure("Couldn't create sync pipe: %s", strerror(errno));
+        report_failure("Couldn't create sync pipe: %s", g_strerror(errno));
         g_free( (gpointer) argv[0]);
         g_free(argv);
         return FALSE;
@@ -610,7 +610,7 @@ sync_pipe_start(capture_options *capture_opts) {
         ws_close(sync_pipe[PIPE_READ]);
         execv(argv[0], (gpointer)argv);
         g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
-                   argv[0], strerror(errno));
+                   argv[0], g_strerror(errno));
         sync_pipe_errmsg_to_parent(2, errmsg, "");
 
         /* Exit with "_exit()", so that we don't close the connection
@@ -644,7 +644,7 @@ sync_pipe_start(capture_options *capture_opts) {
 
     if (capture_opts->fork_child == -1) {
         /* We couldn't even create the child process. */
-        report_failure("Couldn't create child process: %s", strerror(errno));
+        report_failure("Couldn't create child process: %s", g_strerror(errno));
         ws_close(sync_pipe_read_fd);
 #ifdef _WIN32
         ws_close(capture_opts->signal_pipe_write_fd);
@@ -795,7 +795,7 @@ sync_pipe_open_command(const char** argv, int *data_read_fd,
     /* Create a pipe for the child process to send us messages */
     if (pipe(sync_pipe) < 0) {
         /* Couldn't create the message pipe between parent and child. */
-        *msg = g_strdup_printf("Couldn't create sync pipe: %s", strerror(errno));
+        *msg = g_strdup_printf("Couldn't create sync pipe: %s", g_strerror(errno));
         g_free( (gpointer) argv[0]);
         g_free(argv);
         return -1;
@@ -804,7 +804,7 @@ sync_pipe_open_command(const char** argv, int *data_read_fd,
     /* Create a pipe for the child process to send us data */
     if (pipe(data_pipe) < 0) {
         /* Couldn't create the data pipe between parent and child. */
-        *msg = g_strdup_printf("Couldn't create data pipe: %s", strerror(errno));
+        *msg = g_strdup_printf("Couldn't create data pipe: %s", g_strerror(errno));
         ws_close(sync_pipe[PIPE_READ]);
         ws_close(sync_pipe[PIPE_WRITE]);
         g_free( (gpointer) argv[0]);
@@ -825,7 +825,7 @@ sync_pipe_open_command(const char** argv, int *data_read_fd,
         ws_close(sync_pipe[PIPE_WRITE]);
         execv(argv[0], (gpointer)argv);
         g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
-                   argv[0], strerror(errno));
+                   argv[0], g_strerror(errno));
         sync_pipe_errmsg_to_parent(2, errmsg, "");
 
         /* Exit with "_exit()", so that we don't close the connection
@@ -862,7 +862,7 @@ sync_pipe_open_command(const char** argv, int *data_read_fd,
 
     if (*fork_child == -1) {
         /* We couldn't even create the child process. */
-        *msg = g_strdup_printf("Couldn't create child process: %s", strerror(errno));
+        *msg = g_strdup_printf("Couldn't create child process: %s", g_strerror(errno));
         ws_close(*data_read_fd);
         ws_close(*message_read_fd);
         return -1;
@@ -1352,9 +1352,9 @@ pipe_read_bytes(int pipe_fd, char *bytes, int required, char **msg)
             error = errno;
             g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
                   "read from pipe %d: error(%u): %s", pipe_fd, error,
-                  strerror(error));
+                  g_strerror(error));
             *msg = g_strdup_printf("Error reading from sync pipe: %s",
-                                   strerror(error));
+                                   g_strerror(error));
             return newly;
         }
 
@@ -1413,7 +1413,7 @@ sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max) {
         } else if (newly < 0) {
             /* error */
             g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
-                  "read from pipe %d: error(%u): %s", pipe_fd, errno, strerror(errno));
+                  "read from pipe %d: error(%u): %s", pipe_fd, errno, g_strerror(errno));
             return newly;
         } else if (bytes[offset] == '\n') {
             break;
@@ -1654,7 +1654,7 @@ sync_pipe_wait_for_child(int fork_child, gchar **msgp)
     ret = 0;
 #ifdef _WIN32
     if (_cwait(&fork_child_status, fork_child, _WAIT_CHILD) == -1) {
-        *msgp = g_strdup_printf("Error from cwait(): %s", strerror(errno));
+        *msgp = g_strdup_printf("Error from cwait(): %s", g_strerror(errno));
         ret = -1;
     } else {
         /*
@@ -1696,7 +1696,7 @@ sync_pipe_wait_for_child(int fork_child, gchar **msgp)
             ret = -1;
         }
     } else {
-        *msgp = g_strdup_printf("Error from waitpid(): %s", strerror(errno));
+        *msgp = g_strdup_printf("Error from waitpid(): %s", g_strerror(errno));
         ret = -1;
     }
 #endif
@@ -1820,7 +1820,7 @@ signal_pipe_capquit_to_child(capture_options *capture_opts)
     ret = write(capture_opts->signal_pipe_write_fd, quit_msg, sizeof quit_msg);
     if(ret == -1) {
         g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_WARNING,
-              "signal_pipe_capquit_to_child: %d header: error %s", capture_opts->signal_pipe_write_fd, strerror(errno));
+              "signal_pipe_capquit_to_child: %d header: error %s", capture_opts->signal_pipe_write_fd, g_strerror(errno));
     }
 }
 #endif
@@ -1842,7 +1842,7 @@ sync_pipe_stop(capture_options *capture_opts)
         int sts = kill(capture_opts->fork_child, SIGINT);
         if (sts != 0) {
             g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_WARNING,
-                  "Sending SIGINT to child failed: %s\n", strerror(errno));
+                  "Sending SIGINT to child failed: %s\n", g_strerror(errno));
         }
 #else
 #define STOP_SLEEP_TIME 500 /* ms */
@@ -1882,7 +1882,7 @@ sync_pipe_kill(int fork_child)
         int sts = kill(fork_child, SIGTERM);    /* SIGTERM so it can clean up if necessary */
         if (sts != 0) {
             g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_WARNING,
-                  "Sending SIGTERM to child failed: %s\n", strerror(errno));
+                  "Sending SIGTERM to child failed: %s\n", g_strerror(errno));
         }
 #else
         /* Remark: This is not the preferred method of closing a process!
index 480d9d2230d8a21f2e09a7763d574dfc5ca1cc16..dee71aca12bc62fb4cb8ca3c5b672de5ee255cfe 100644 (file)
 /* Define if inet/v6defs.h needs to be included */
 #cmakedefine NEED_INET_V6DEFS_H 1
 
-/* Define if strerror.h needs to be included */
-#cmakedefine NEED_STRERROR_H 1
-
 /* Define if strptime.h needs to be included */
 #cmakedefine NEED_STRPTIME_H 1
 
index 2c21bfb14b56b20811128f30760740616c815d7d..ba07aad192df3cb16db1391fab899c617f63cb0c 100644 (file)
@@ -634,7 +634,7 @@ read_users_filters(GSList **cfl)
                if (errno != ENOENT) {
                        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                            "Could not open filter file\n\"%s\": %s.", path,
-                           strerror(errno));
+                           g_strerror(errno));
                }
                g_free(path);
                return FALSE;
@@ -661,7 +661,7 @@ color_filters_read_globals(gpointer user_data)
                if (errno != ENOENT) {
                        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                            "Could not open global filter file\n\"%s\": %s.", path,
-                           strerror(errno));
+                           g_strerror(errno));
                }
                g_free(path);
                return FALSE;
@@ -684,7 +684,7 @@ color_filters_import(gchar *path, gpointer user_data)
        if ((f = ws_fopen(path, "r")) == NULL) {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Could not open\n%s\nfor reading: %s.",
-                   path, strerror(errno));
+                   path, g_strerror(errno));
                return FALSE;
        }
 
@@ -749,7 +749,7 @@ color_filters_write(GSList *cfl)
        if (create_persconffile_dir(&pf_dir_path) == -1) {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Can't create directory\n\"%s\"\nfor color files: %s.",
-                   pf_dir_path, strerror(errno));
+                   pf_dir_path, g_strerror(errno));
                g_free(pf_dir_path);
                return FALSE;
        }
@@ -758,7 +758,7 @@ color_filters_write(GSList *cfl)
        if ((f = ws_fopen(path, "w+")) == NULL) {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Could not open\n%s\nfor writing: %s.",
-                   path, strerror(errno));
+                   path, g_strerror(errno));
                g_free(path);
                return FALSE;
        }
@@ -777,7 +777,7 @@ color_filters_export(gchar *path, GSList *cfl, gboolean only_marked)
        if ((f = ws_fopen(path, "w+")) == NULL) {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Could not open\n%s\nfor writing: %s.",
-                   path, strerror(errno));
+                   path, g_strerror(errno));
                return FALSE;
        }
        write_filters_file(cfl, f, only_marked);
index 15d15dc27cc6774c2d3ea08032eb077a1a95abc3..454b7e79ea11f29fe392269d8dc71d23e8a56439 100644 (file)
@@ -43,8 +43,6 @@
 
 /* #undef HAVE_SA_LEN */
 
-/* #undef NEED_STRERROR_H */
-
 /* #undef HAVE_MKSTEMP */
 /* #undef HAVE_MKDTEMP */
 
index ce8c389a6510c722bc63cfc7643211ad8f3898a7..44a084415ce0c0fab8dba9528571ce04c3b97e00 100644 (file)
@@ -1754,16 +1754,6 @@ fi
 AM_CONDITIONAL(NEED_GETOPT_LO, test "x$ac_cv_func_getopt" = "xno")
 AC_SUBST(GETOPT_LO)
 
-AC_CHECK_FUNC(strerror, STRERROR_LO="",
-  [STRERROR_LO="strerror.lo"
-   AC_DEFINE(NEED_STRERROR_H, 1, [Define if strerror.h needs to be included])
-])
-if test "$ac_cv_func_strerror" = no ; then
-  STRERROR_LO="strerror.lo"
-fi
-AM_CONDITIONAL(NEED_STRERROR_LO, test "x$ac_cv_func_strerror" = "xno")
-AC_SUBST(STRERROR_LO)
-
 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="",
   STRNCASECMP_LO="strncasecmp.lo")
 if test "$ac_cv_func_strncasecmp" = no ; then
index c7ad6f363c41d80cf0f69a11241d1127af2119e8..c3f42f14f586ef0e043d7b1f50eb8ebb9b3103dc 100644 (file)
--- a/dftest.c
+++ b/dftest.c
 #include <string.h>
 #include <errno.h>
 
-#ifdef NEED_STRERROR_H
-#include "wsutil/strerror.h"
-#endif
-
 #include <glib.h>
 #include <epan/epan.h>
 
@@ -103,24 +99,24 @@ main(int argc, char **argv)
                if (gpf_open_errno != 0) {
                        fprintf(stderr,
                                "can't open global preferences file \"%s\": %s.\n",
-                               pf_path, strerror(gpf_open_errno));
+                               pf_path, g_strerror(gpf_open_errno));
                }
                if (gpf_read_errno != 0) {
                        fprintf(stderr,
                                "I/O error reading global preferences file \"%s\": %s.\n",
-                               pf_path, strerror(gpf_read_errno));
+                               pf_path, g_strerror(gpf_read_errno));
                }
        }
        if (pf_path != NULL) {
                if (pf_open_errno != 0) {
                        fprintf(stderr,
                                "can't open your preferences file \"%s\": %s.\n",
-                               pf_path, strerror(pf_open_errno));
+                               pf_path, g_strerror(pf_open_errno));
                }
                if (pf_read_errno != 0) {
                        fprintf(stderr,
                                "I/O error reading your preferences file \"%s\": %s.\n",
-                               pf_path, strerror(pf_read_errno));
+                               pf_path, g_strerror(pf_read_errno));
                }
        }
 
@@ -189,7 +185,7 @@ static void
 read_failure_message(const char *filename, int err)
 {
        fprintf(stderr, "dftest: An error occurred while reading from the file \"%s\": %s.\n",
-               filename, strerror(err));
+               filename, g_strerror(err));
 }
 
 /*
@@ -199,5 +195,5 @@ static void
 write_failure_message(const char *filename, int err)
 {
        fprintf(stderr, "dftest: An error occurred while writing to the file \"%s\": %s.\n",
-               filename, strerror(err));
+               filename, g_strerror(err));
 }
index 858e36b9d72de4ce67ebfd0d5bbd887cd2b754db..f1ae2f2fe790015827557baf356034c3ca4f95ab 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -539,7 +539,7 @@ relinquish_all_capabilities(void)
     cap_t caps = cap_init();    /* all capabilities initialized to off */
     print_caps("Pre-clear");
     if (cap_set_proc(caps)) {
-        cmdarg_err("cap_set_proc() fail return: %s", strerror(errno));
+        cmdarg_err("cap_set_proc() fail return: %s", g_strerror(errno));
     }
     print_caps("Post-clear");
     cap_free(caps);
@@ -1467,14 +1467,14 @@ relinquish_privs_except_capture(void)
         print_caps("Pre drop, pre set");
 
         if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) == -1) {
-            cmdarg_err("prctl() fail return: %s", strerror(errno));
+            cmdarg_err("prctl() fail return: %s", g_strerror(errno));
         }
 
         cap_set_flag(caps, CAP_PERMITTED,   cl_len, cap_list, CAP_SET);
         cap_set_flag(caps, CAP_INHERITABLE, cl_len, cap_list, CAP_SET);
 
         if (cap_set_proc(caps)) {
-            cmdarg_err("cap_set_proc() fail return: %s", strerror(errno));
+            cmdarg_err("cap_set_proc() fail return: %s", g_strerror(errno));
         }
         print_caps("Pre drop, post set");
 
@@ -1483,7 +1483,7 @@ relinquish_privs_except_capture(void)
         print_caps("Post drop, pre set");
         cap_set_flag(caps, CAP_EFFECTIVE,   cl_len, cap_list, CAP_SET);
         if (cap_set_proc(caps)) {
-            cmdarg_err("cap_set_proc() fail return: %s", strerror(errno));
+            cmdarg_err("cap_set_proc() fail return: %s", g_strerror(errno));
         }
         print_caps("Post drop, post set");
 
@@ -1688,7 +1688,7 @@ cap_pipe_open_live(char *pipename,
             else {
                 g_snprintf(errmsg, errmsgl,
                            "The capture session could not be initiated "
-                           "due to error getting information on pipe/socket: %s", strerror(errno));
+                           "due to error getting information on pipe/socket: %s", g_strerror(errno));
                 pcap_opts->cap_pipe_err = PIPERR;
             }
             return;
@@ -1698,7 +1698,7 @@ cap_pipe_open_live(char *pipename,
             if (fd == -1) {
                 g_snprintf(errmsg, errmsgl,
                            "The capture session could not be initiated "
-                           "due to error on pipe open: %s", strerror(errno));
+                           "due to error on pipe open: %s", g_strerror(errno));
                 pcap_opts->cap_pipe_err = PIPERR;
                 return;
             }
@@ -1707,7 +1707,7 @@ cap_pipe_open_live(char *pipename,
             if (fd == -1) {
                 g_snprintf(errmsg, errmsgl,
                            "The capture session could not be initiated "
-                           "due to error on socket create: %s", strerror(errno));
+                           "due to error on socket create: %s", g_strerror(errno));
                 pcap_opts->cap_pipe_err = PIPERR;
                 return;
             }
@@ -1747,7 +1747,7 @@ cap_pipe_open_live(char *pipename,
             if (b == -1) {
                 g_snprintf(errmsg, errmsgl,
                            "The capture session coud not be initiated "
-                           "due to error on socket connect: %s", strerror(errno));
+                           "due to error on socket connect: %s", g_strerror(errno));
                 pcap_opts->cap_pipe_err = PIPERR;
                 return;
             }
@@ -1833,7 +1833,7 @@ cap_pipe_open_live(char *pipename,
         sel_ret = cap_pipe_select(fd);
         if (sel_ret < 0) {
             g_snprintf(errmsg, errmsgl,
-                       "Unexpected error from select: %s", strerror(errno));
+                       "Unexpected error from select: %s", g_strerror(errno));
             goto error;
         } else if (sel_ret > 0) {
             b = read(fd, ((char *)&magic)+bytes_read, sizeof magic-bytes_read);
@@ -1842,7 +1842,7 @@ cap_pipe_open_live(char *pipename,
                     g_snprintf(errmsg, errmsgl, "End of file on pipe magic during open");
                 else
                     g_snprintf(errmsg, errmsgl, "Error on pipe magic during open: %s",
-                               strerror(errno));
+                               g_strerror(errno));
                 goto error;
             }
             bytes_read += b;
@@ -1862,7 +1862,7 @@ cap_pipe_open_live(char *pipename,
             g_snprintf(errmsg, errmsgl, "End of file on pipe magic during open");
         else
             g_snprintf(errmsg, errmsgl, "Error on pipe magic during open: %s",
-                       strerror(errno));
+                       g_strerror(errno));
         goto error;
     }
 
@@ -1908,7 +1908,7 @@ cap_pipe_open_live(char *pipename,
         sel_ret = cap_pipe_select(fd);
         if (sel_ret < 0) {
             g_snprintf(errmsg, errmsgl,
-                       "Unexpected error from select: %s", strerror(errno));
+                       "Unexpected error from select: %s", g_strerror(errno));
             goto error;
         } else if (sel_ret > 0) {
             b = read(fd, ((char *)hdr)+bytes_read,
@@ -1918,7 +1918,7 @@ cap_pipe_open_live(char *pipename,
                     g_snprintf(errmsg, errmsgl, "End of file on pipe header during open");
                 else
                     g_snprintf(errmsg, errmsgl, "Error on pipe header during open: %s",
-                               strerror(errno));
+                               g_strerror(errno));
                 goto error;
             }
             bytes_read += b;
@@ -1935,7 +1935,7 @@ cap_pipe_open_live(char *pipename,
             g_snprintf(errmsg, errmsgl, "End of file on pipe header during open");
         else
             g_snprintf(errmsg, errmsgl, "Error on pipe header header during open: %s",
-                       strerror(errno));
+                       g_strerror(errno));
         goto error;
     }
 #endif /* USE_THREADS */
@@ -2148,7 +2148,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
         LocalFree(err_str);
 #else
         g_snprintf(errmsg, errmsgl, "Error reading from pipe: %s",
-                   strerror(errno));
+                   g_strerror(errno));
 #endif
         /* Fall through */
     case PD_ERR:
@@ -2554,7 +2554,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
                 g_snprintf(errmsg, errmsg_len,
                            "The file to which the capture would be"
                            " saved (\"%s\") could not be opened: %s.",
-                           capture_opts->save_file, strerror(err));
+                           capture_opts->save_file, g_strerror(err));
             }
             break;
         }
@@ -2622,7 +2622,7 @@ capture_loop_dispatch(loop_data *ld,
         if (sel_ret <= 0) {
             if (sel_ret < 0 && errno != EINTR) {
                 g_snprintf(errmsg, errmsg_len,
-                           "Unexpected error from select: %s", strerror(errno));
+                           "Unexpected error from select: %s", g_strerror(errno));
                 report_capture_error(errmsg, please_report);
                 ld->go = FALSE;
             }
@@ -2686,7 +2686,7 @@ capture_loop_dispatch(loop_data *ld,
             } else {
                 if (sel_ret < 0 && errno != EINTR) {
                     g_snprintf(errmsg, errmsg_len,
-                               "Unexpected error from select: %s", strerror(errno));
+                               "Unexpected error from select: %s", g_strerror(errno));
                     report_capture_error(errmsg, please_report);
                     ld->go = FALSE;
                 }
@@ -2882,7 +2882,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
         if (is_tempfile) {
             g_snprintf(errmsg, errmsg_len,
                        "The temporary file to which the capture would be saved (\"%s\") "
-                       "could not be opened: %s.", capfile_name, strerror(errno));
+                       "could not be opened: %s.", capfile_name, g_strerror(errno));
         } else {
             if (capture_opts->multi_files_on) {
                 ringbuf_error_cleanup();
@@ -2891,7 +2891,7 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
             g_snprintf(errmsg, errmsg_len,
                        "The file to which the capture would be saved (\"%s\") "
                        "could not be opened: %s.", capfile_name,
-                       strerror(errno));
+                       g_strerror(errno));
         }
         g_free(capfile_name);
         return FALSE;
@@ -3337,7 +3337,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
             /* On Linux, if an interface goes down while you're capturing on it,
                you'll get a "recvfrom: Network is down" or
                "The interface went down" error (ENETDOWN).
-               (At least you will if strerror() doesn't show a local translation
+               (At least you will if g_strerror() doesn't show a local translation
                of the error.)
 
                On FreeBSD and OS X, if a network adapter disappears while
@@ -3527,13 +3527,13 @@ capture_loop_get_errmsg(char *errmsg, int errmsglen, const char *fname,
             g_snprintf(errmsg, errmsglen,
                        "The file to which the capture was being saved\n"
                        "(\"%s\") could not be closed: %s.",
-                       fname, strerror(err));
+                       fname, g_strerror(err));
         } else {
             g_snprintf(errmsg, errmsglen,
                        "An error occurred while writing to the file"
                        " to which the capture was being saved\n"
                        "(\"%s\"): %s.",
-                       fname, strerror(err));
+                       fname, g_strerror(err));
         }
         break;
     }
index 1012e13d2992a8ec7a1f936dbdf5e7674bdf60e0..c2699f8dd74cbbe660e22188a9f9ddf28ab4fd09 100644 (file)
@@ -115,7 +115,7 @@ void dfilter_macro_save(const gchar* filename, gchar** error) {
        FILE* f = ws_fopen(filename,"w");
 
        if (!f) {
-               *error = ep_strdup_printf("Could not open file: '%s', error: %s\n", filename, strerror(errno) );
+               *error = ep_strdup_printf("Could not open file: '%s', error: %s\n", filename, g_strerror(errno) );
                return;
        }
 
index bdcfc2b8a53967811e4640f3f4f1fb115a097192..6cd783c4bbecdfd379a9e3653c57861e79abebb6 100644 (file)
@@ -275,7 +275,7 @@ description_attr description=\042
                        D(("entity: %s filename: %s yyin: %p\n",e->name,e->file,yyin));
                        if (!yyin) {
                                if (errno) {
-                                       fprintf(stderr, "Could not open file: '%s', error: %s\n", e->file, strerror(errno) );
+                                       fprintf(stderr, "Could not open file: '%s', error: %s\n", e->file, g_strerror(errno) );
                                        yyterminate();
                                }
                        } else {
index 5b3e67f830b6894dcc4afab964f1ebbb485f6d33..e82a600e2759a880aeb0a893ad2dabc446e37949 100644 (file)
 #include <ctype.h>
 #include <glib.h>
 #include <math.h>
-#ifdef NEED_STRERROR_H
-#include "wsutil/strerror.h"
-#endif
 
 #include "isprint.h"
 
@@ -1321,7 +1318,7 @@ static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) {
 
   if (fp == NULL) {
     if (errno == EACCES)
-      fprintf(stderr, "Error opening file %s for reading: %s\n", name, strerror(errno));
+      fprintf(stderr, "Error opening file %s for reading: %s\n", name, g_strerror(errno));
     return;
   }
 
index 276b19d0babfb64074068624640e22adf362864d..7e951b0f6b96b892e96c2cc1d5d270d80df4b772 100644 (file)
@@ -200,7 +200,7 @@ extern GString* dtd_preparse(const gchar* dname,const  gchar* fname, GString* er
 
        if (!yyin) {
                if (err)
-                       g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,strerror(errno));
+                       g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,g_strerror(errno));
 
                return NULL;
        }
index 01f6324ce8968fb81c66b3b866505ce95f7c763d..1072d91d59aef12d997a0f19c1be5e98e5f5f12d 100644 (file)
@@ -395,7 +395,7 @@ init_progfile_dir(const char *arg0
                         * allocate for the current directory.
                         */
                        return g_strdup_printf("pathconf failed: %s\n",
-                           strerror(errno));
+                           g_strerror(errno));
                }
                curdir = (char *)g_malloc(path_max);
                if (getcwd(curdir, path_max) == NULL) {
@@ -405,7 +405,7 @@ init_progfile_dir(const char *arg0
                         */
                        g_free(curdir);
                        return g_strdup_printf("getcwd failed: %s\n",
-                           strerror(errno));
+                           g_strerror(errno));
                }
                path = g_strdup_printf("%s/%s", curdir, arg0);
                g_free(curdir);
@@ -1650,7 +1650,7 @@ file_open_error_message(int err, gboolean for_writing)
                g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                           "The file \"%%s\" could not be %s: %s.",
                           for_writing ? "created" : "opened",
-                          strerror(err));
+                          g_strerror(err));
                errmsg = errmsg_errno;
                break;
        }
@@ -1686,7 +1686,7 @@ file_write_error_message(int err)
        default:
                g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                           "An error occurred while writing to the file \"%%s\": %s.",
-                          strerror(err));
+                          g_strerror(err));
                errmsg = errmsg_errno;
                break;
        }
index 9a4f242271c114e40653f69910018449c9a2ed67..75a0ed1bddbe40a08066fb0c2b9c3480c3b07631 100644 (file)
 
        if (!yyin) {
                if (errno) {
-                       g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );
+                       g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], g_strerror(errno) );
                        yyterminate();
                }
        } else {
@@ -583,7 +583,7 @@ gboolean radius_load_dictionary (radius_dictionary_t* d, gchar* dir, const gchar
        yyin = ws_fopen(fullpaths[include_stack_ptr],"r");
 
        if (!yyin) {
-               g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], strerror(errno) );
+               g_string_append_printf(error, "Could not open file: '%s', error: %s\n", fullpaths[include_stack_ptr], g_strerror(errno) );
                g_free(fullpaths[include_stack_ptr]);
                *err_str = error->str;
                g_string_free(error,FALSE);
index a2081c1b392374e9e68ed585f97fad466855c6e5..97066e732a3ee0a0a1409fc477a92255cac2d49b 100644 (file)
@@ -262,7 +262,7 @@ gboolean uat_save(uat_t* uat, char** error) {
     }
 
        if (!fp) {
-               *error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,strerror(errno));
+               *error = ep_strdup_printf("uat_save: error opening '%s': %s",fname,g_strerror(errno));
                return FALSE;
        }
 
@@ -449,7 +449,7 @@ gboolean uat_fld_chk_num_dec(void* u1 _U_, const char* strptr, unsigned len, con
         long i = strtol(str,&str,10);
 
         if ( ( i == 0) && (errno == ERANGE || errno == EINVAL) ) {
-            *err = strerror(errno);
+            *err = g_strerror(errno);
             return FALSE;
         }
     }
@@ -464,7 +464,7 @@ gboolean uat_fld_chk_num_hex(void* u1 _U_, const char* strptr, unsigned len, con
         long i = strtol(str,&str,16);
 
         if ( ( i == 0) && (errno == ERANGE || errno == EINVAL) ) {
-            *err = strerror(errno);
+            *err = g_strerror(errno);
             return FALSE;
         }
     }
index 6d9a4a85e93fecb87487f1fc4042112550cffaeb..3ad28ed08b2d427919cbe39ae9728099f0389217 100644 (file)
@@ -285,7 +285,7 @@ gboolean uat_load(uat_t* uat_in, char** err) {
 
 
        if (!(yyin = ws_fopen(fname,"r"))) {
-               *err = strerror(errno);
+               *err = g_strerror(errno);
                g_free(fname);
                return FALSE;
        }
index fbea665ece4b747ad9862198815a798c16f099ef..0a16948120b6581eb66dfc5089b6b6213b045ccc 100644 (file)
@@ -84,7 +84,7 @@ write_prefs_to_file(void)
   if (create_persconffile_dir(&pf_dir_path) == -1) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't create directory\n\"%s\"\nfor preferences file: %s.", pf_dir_path,
-      strerror(errno));
+      g_strerror(errno));
      g_free(pf_dir_path);
   } else {
     /* Write the preferencs out. */
@@ -92,7 +92,7 @@ write_prefs_to_file(void)
     if (err != 0) {
        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
         "Can't open preferences file\n\"%s\": %s.", pf_path,
-        strerror(err));
+        g_strerror(err));
        g_free(pf_path);
     }
   }
index c42694c75acf15d5541c587e11a21727bee2a47e..f0a07ae8ceb287f1744d75d61cb6074986aa437c 100644 (file)
@@ -1080,7 +1080,7 @@ color_apply_cb(GtkButton *button _U_, gpointer user_data _U_)
   if (!prefs.gui_use_pref_save) {
       if (!color_filters_write(color_filter_edit_list))
             simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                "Could not open filter file: %s", strerror(errno));
+                "Could not open filter file: %s", g_strerror(errno));
   }
 
   /* Apply the coloring rules, both the temporary ones in
@@ -1100,7 +1100,7 @@ color_save_cb(GtkButton *button _U_, gpointer user_data _U_)
 
   if (!color_filters_write(color_filter_edit_list))
         simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-            "Could not open filter file: %s", strerror(errno));
+            "Could not open filter file: %s", g_strerror(errno));
 }
 
 /* User pressed "Cancel" button (or "ESC" or the 'X'):
index c641257f0144be2e41c8d3aa1b805eb3548a5b4c..ae6d5880b7be64881aac643596a00ed2468e5dc6 100644 (file)
@@ -837,7 +837,7 @@ filter_dlg_save(filter_list_type_t list_type)
     if (create_persconffile_dir(&pf_dir_path) == -1) {
         simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
             "Can't create directory\n\"%s\"\nfor filter files: %s.",
-            pf_dir_path, strerror(errno));
+            pf_dir_path, g_strerror(errno));
         g_free(pf_dir_path);
         return;
     }
@@ -847,7 +847,7 @@ filter_dlg_save(filter_list_type_t list_type)
         /* We had an error saving the filter. */
         simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
             "Could not save to your %s filter file\n\"%s\": %s.",
-            filter_type, f_path, strerror(f_save_errno));
+            filter_type, f_path, g_strerror(f_save_errno));
         g_free(f_path);
     }
 }
index cbc672dbe80f58c6418855c587ecbdf36d4f1f0c..15a454184e54aa64a3a4f65d5e5774111a655196 100644 (file)
@@ -503,7 +503,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
        } else {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                              "Error writing to print command: %s",
-                             strerror(errno));
+                             g_strerror(errno));
        }
        /* XXX - cancel printing? */
        destroy_print_stream(stream);
@@ -941,7 +941,7 @@ follow_destroy_cb(GtkWidget *w, gpointer data _U_)
        case FOLLOW_TCP :
                i = ws_unlink(follow_info->data_out_filename);
                if(i != 0) {
-                       g_warning("Follow: Couldn't remove temporary file: \"%s\", errno: %s (%u)", follow_info->data_out_filename, strerror(errno), errno);
+                       g_warning("Follow: Couldn't remove temporary file: \"%s\", errno: %s (%u)", follow_info->data_out_filename, g_strerror(errno), errno);
                }
                break;
 
index 861aa79fc96b64e1f53c725276e730635d24bbd2..d23f00aa31ce39c5dd528afb5c78248122a20a1f 100644 (file)
@@ -145,7 +145,7 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
        if (tmp_fd == -1) {
            simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                          "Could not create temporary file %s: %s",
-                         follow_info->data_out_filename, strerror(errno));
+                         follow_info->data_out_filename, g_strerror(errno));
            g_free(follow_info->data_out_filename);
            g_free(follow_info);
            g_free(follow_filter);
@@ -156,7 +156,7 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
        if (data_out_file == NULL) {
            simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                          "Could not create temporary file %s: %s",
-                         follow_info->data_out_filename, strerror(errno));
+                         follow_info->data_out_filename, g_strerror(errno));
            ws_close(tmp_fd);
            ws_unlink(follow_info->data_out_filename);
            g_free(follow_info->data_out_filename);
@@ -227,7 +227,7 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
            if (ferror(data_out_file)) {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                              "Could not read from temporary file %s: %s",
-                             follow_info->data_out_filename, strerror(errno));
+                             follow_info->data_out_filename, g_strerror(errno));
            } else {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                              "Short read from temporary file %s: expected %lu, got %lu",
@@ -358,7 +358,7 @@ follow_read_tcp_stream(follow_info_t *follow_info,
     if (data_out_file == NULL) {
        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                      "Could not open temporary file %s: %s", follow_info->data_out_filename,
-                     strerror(errno));
+                     g_strerror(errno));
        return FRS_OPEN_ERROR;
     }
 
@@ -421,7 +421,7 @@ follow_read_tcp_stream(follow_info_t *follow_info,
     if (ferror(data_out_file)) {
        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                      "Error reading temporary file %s: %s", follow_info->data_out_filename,
-                     strerror(errno));
+                     g_strerror(errno));
        fclose(data_out_file);
        data_out_file = NULL;
        return FRS_READ_ERROR;
index 25d3ad5be28e5014c520c9215904e62aa4b4bad5..e04932267b2ae74ee86def3a208a66b382ada801 100644 (file)
@@ -510,7 +510,7 @@ static gboolean funnel_open_file(const char* fname, const char* filter, const ch
 
 
        if (cf_open(&cfile, fname, FALSE, &err) != CF_OK) {
-               *err_str = strerror(err);
+               *err_str = g_strerror(err);
                if (rfcode != NULL) dfilter_free(rfcode);
                return FALSE;
        }
index faff151a839e29a9d5767cb0d1b6ad137029aa44..f4213486ed0047a1919d764799afee1d43d73ea5 100644 (file)
 #include <unistd.h>
 #endif
 
-#ifdef NEED_STRERROR_H
-#include "wsutil/strerror.h"
-#endif
-
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #else
@@ -1871,24 +1867,24 @@ read_configuration_files(char **gdp_path, char **dp_path)
     if (gpf_open_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "Could not open global preferences file\n\"%s\": %s.", gpf_path,
-        strerror(gpf_open_errno));
+        g_strerror(gpf_open_errno));
     }
     if (gpf_read_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "I/O error reading global preferences file\n\"%s\": %s.", gpf_path,
-        strerror(gpf_read_errno));
+        g_strerror(gpf_read_errno));
     }
   }
   if (pf_path != NULL) {
     if (pf_open_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "Could not open your preferences file\n\"%s\": %s.", pf_path,
-        strerror(pf_open_errno));
+        g_strerror(pf_open_errno));
     }
     if (pf_read_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "I/O error reading your preferences file\n\"%s\": %s.", pf_path,
-        strerror(pf_read_errno));
+        g_strerror(pf_read_errno));
     }
     g_free(pf_path);
     pf_path = NULL;
@@ -1906,7 +1902,7 @@ read_configuration_files(char **gdp_path, char **dp_path)
   if (cf_path != NULL) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "Could not open your capture filter file\n\"%s\": %s.", cf_path,
-        strerror(cf_open_errno));
+        g_strerror(cf_open_errno));
       g_free(cf_path);
   }
 
@@ -1915,7 +1911,7 @@ read_configuration_files(char **gdp_path, char **dp_path)
   if (df_path != NULL) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "Could not open your display filter file\n\"%s\": %s.", df_path,
-        strerror(df_open_errno));
+        g_strerror(df_open_errno));
       g_free(df_path);
   }
 
@@ -1926,12 +1922,12 @@ read_configuration_files(char **gdp_path, char **dp_path)
     if (gdp_open_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "Could not open global disabled protocols file\n\"%s\": %s.",
-       *gdp_path, strerror(gdp_open_errno));
+       *gdp_path, g_strerror(gdp_open_errno));
     }
     if (gdp_read_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "I/O error reading global disabled protocols file\n\"%s\": %s.",
-       *gdp_path, strerror(gdp_read_errno));
+       *gdp_path, g_strerror(gdp_read_errno));
     }
     g_free(*gdp_path);
     *gdp_path = NULL;
@@ -1940,12 +1936,12 @@ read_configuration_files(char **gdp_path, char **dp_path)
     if (dp_open_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "Could not open your disabled protocols file\n\"%s\": %s.", *dp_path,
-        strerror(dp_open_errno));
+        g_strerror(dp_open_errno));
     }
     if (dp_read_errno != 0) {
       simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
         "I/O error reading your disabled protocols file\n\"%s\": %s.", *dp_path,
-        strerror(dp_read_errno));
+        g_strerror(dp_read_errno));
     }
     g_free(*dp_path);
     *dp_path = NULL;
@@ -2159,7 +2155,7 @@ main(int argc, char *argv[])
   if (rf_path != NULL && rf_open_errno != 0) {
     simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
                  "Could not open common recent file\n\"%s\": %s.",
-                 rf_path, strerror(rf_open_errno));
+                 rf_path, g_strerror(rf_open_errno));
   }
 
   /* "pre-scan" the command line parameters, if we have "console only"
@@ -2254,7 +2250,7 @@ main(int argc, char *argv[])
   if (rf_path != NULL && rf_open_errno != 0) {
     simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
                  "Could not open recent file\n\"%s\": %s.",
-                 rf_path, strerror(rf_open_errno));
+                 rf_path, g_strerror(rf_open_errno));
   }
 
   if (recent.gui_fileopen_remembered_dir &&
@@ -2789,7 +2785,7 @@ main(int argc, char *argv[])
   if (rf_path != NULL && rf_open_errno != 0) {
     simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
                  "Could not open recent file\n\"%s\": %s.",
-                 rf_path, strerror(rf_open_errno));
+                 rf_path, g_strerror(rf_open_errno));
   }
 
   color_filters_enable(recent.packet_list_colorize);
@@ -3656,7 +3652,7 @@ static void copy_global_profile (const gchar *profile_name)
    if (create_persconffile_profile(profile_name, &pf_dir_path) == -1) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                   "Can't create directory\n\"%s\":\n%s.",
-                  pf_dir_path, strerror(errno));
+                  pf_dir_path, g_strerror(errno));
 
      g_free(pf_dir_path);
    }
@@ -3665,7 +3661,7 @@ static void copy_global_profile (const gchar *profile_name)
                                 &pf_dir_path, &pf_dir_path2) == -1) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                   "Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
-                  pf_filename, pf_dir_path2, pf_dir_path, strerror(errno));
+                  pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
 
      g_free(pf_filename);
      g_free(pf_dir_path);
@@ -3718,7 +3714,7 @@ void change_configuration_profile (const gchar *profile_name)
    if (rf_path != NULL && rf_open_errno != 0) {
      simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
                  "Could not open common recent file\n\"%s\": %s.",
-                 rf_path, strerror(rf_open_errno));
+                 rf_path, g_strerror(rf_open_errno));
    }
    if (recent.gui_fileopen_remembered_dir &&
        test_for_directory(recent.gui_fileopen_remembered_dir) == EISDIR) {
index 6425697c195a673d31822b4c4d75609c7ff4345c..1ff83198df4a474f7cd871aad3dfc196006ec577 100644 (file)
@@ -1431,7 +1431,7 @@ prefs_main_write(void)
   if (create_persconffile_dir(&pf_dir_path) == -1) {
     simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                   "Can't create directory\n\"%s\"\nfor preferences file: %s.", pf_dir_path,
-                  strerror(errno));
+                  g_strerror(errno));
     g_free(pf_dir_path);
   } else {
     /* Write the preferencs out. */
@@ -1439,7 +1439,7 @@ prefs_main_write(void)
     if (err != 0) {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                     "Can't open preferences file\n\"%s\": %s.", pf_path,
-                    strerror(err));
+                    g_strerror(err));
       g_free(pf_path);
     }
   }
index c5399ec0cf56907a8602f0fb2d2e3dbd7e0cbbec..1a9d486c210f8567fc47515766a1e8c7c07e2074 100644 (file)
@@ -1107,7 +1107,7 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
       write_failure_alert_box(args->file, errno);
     else
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-       "Error writing to print command: %s", strerror(errno));
+       "Error writing to print command: %s", g_strerror(errno));
     break;
   }
 
index e496ad61c5c5e0315a4845e6b43eef4b107263f3..9d8d88cdd73c323887d6000293c399de271eb158 100644 (file)
@@ -383,7 +383,7 @@ profile_apply(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
       if (create_persconffile_profile(profile1->name, &pf_dir_path) == -1) {
         simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                       "Can't create directory\n\"%s\":\n%s.",
-                      pf_dir_path, strerror(errno));
+                      pf_dir_path, g_strerror(errno));
         
         g_free(pf_dir_path);
       }
@@ -394,7 +394,7 @@ profile_apply(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
                                      &pf_filename, &pf_dir_path, &pf_dir_path2) == -1) {
           simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                         "Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
-                        pf_filename, pf_dir_path2, pf_dir_path, strerror(errno));
+                        pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
 
           g_free(pf_filename);
           g_free(pf_dir_path);
@@ -420,7 +420,7 @@ profile_apply(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
        if (create_persconffile_profile(profile1->name, &pf_dir_path) == -1) {
          simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                        "Can't create directory\n\"%s\":\n%s.",
-                       pf_dir_path, strerror(errno));
+                       pf_dir_path, g_strerror(errno));
 
          g_free(pf_dir_path);
        }
@@ -436,7 +436,7 @@ profile_apply(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
                                        &pf_dir_path, &pf_dir_path2) == -1) {
          simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                        "Can't rename directory\n\"%s\" to\n\"%s\":\n%s.",
-                       pf_dir_path, pf_dir_path2, strerror(errno));
+                       pf_dir_path, pf_dir_path2, g_strerror(errno));
 
          g_free(pf_dir_path);
          g_free(pf_dir_path2);
@@ -473,7 +473,7 @@ profile_apply(GtkWidget *main_w, GtkTreeView *profile_l, gboolean destroy)
       if (delete_persconffile_profile(profile1->name, &pf_dir_path) == -1) {
        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                      "Can't delete profile directory\n\"%s\":\n%s.",
-                     pf_dir_path, strerror(errno));
+                     pf_dir_path, g_strerror(errno));
 
        g_free(pf_dir_path);
       }
@@ -1143,7 +1143,7 @@ profile_name_edit_ok (GtkWidget *w _U_, gpointer parent_w)
     if (create_persconffile_profile(new_name, &pf_dir_path) == -1) {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Can't create directory\n\"%s\":\n%s.",
-                   pf_dir_path, strerror(errno));
+                   pf_dir_path, g_strerror(errno));
       
       g_free(pf_dir_path);
     } else if (strlen (profile_name) && 
@@ -1152,7 +1152,7 @@ profile_name_edit_ok (GtkWidget *w _U_, gpointer parent_w)
     {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Can't copy file \"%s\" in directory\n\"%s\" to\n\"%s\":\n%s.",
-                   pf_filename, pf_dir_path2, pf_dir_path, strerror(errno));
+                   pf_filename, pf_dir_path2, pf_dir_path, g_strerror(errno));
        
       g_free(pf_filename);
       g_free(pf_dir_path);
@@ -1166,7 +1166,7 @@ profile_name_edit_ok (GtkWidget *w _U_, gpointer parent_w)
                                    &pf_dir_path, &pf_dir_path2) == -1) {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Can't rename directory\n\"%s\" to\n\"%s\":\n%s.",
-                   pf_dir_path, pf_dir_path2, strerror(errno));
+                   pf_dir_path, pf_dir_path2, g_strerror(errno));
       
       g_free(pf_dir_path);
       g_free(pf_dir_path2);
@@ -1347,7 +1347,7 @@ profile_delete_cb (GtkWidget *w _U_, gpointer data _U_)
     if (delete_persconffile_profile(name, &pf_dir_path) == -1) {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Can't delete profile directory\n\"%s\":\n%s.",
-                   pf_dir_path, strerror(errno));
+                   pf_dir_path, g_strerror(errno));
       
       g_free(pf_dir_path);
     }
index dd0e7ada0d70c739259f20e4524bf53642462392..4c9d4e64f4bd4008477c934218c40755d48d29ec 100644 (file)
@@ -372,14 +372,14 @@ proto_write(gpointer parent_w _U_)
   if (create_persconffile_dir(&pf_dir_path) == -1) {
     simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                   "Can't create directory\n\"%s\"\nfor disabled protocols file: %s.", pf_dir_path,
-                  strerror(errno));
+                  g_strerror(errno));
     g_free(pf_dir_path);
   } else {
     save_disabled_protos_list(&pf_path, &pf_save_errno);
     if (pf_path != NULL) {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                     "Could not save to your disabled protocols file\n\"%s\": %s.",
-                    pf_path, strerror(pf_save_errno));
+                    pf_path, g_strerror(pf_save_errno));
       g_free(pf_path);
     }
   }
index 98857ff79dd4562068729fbe0f42efddbafa2c20..e49543e2fefa5cbd8f5a10db6893ffe6ee708a60 100644 (file)
@@ -154,7 +154,7 @@ write_recent(void)
   if (create_persconffile_dir(&pf_dir_path) == -1) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't create directory\n\"%s\"\nfor recent file: %s.", pf_dir_path,
-      strerror(errno));
+      g_strerror(errno));
      g_free(pf_dir_path);
      return FALSE;
   }
@@ -163,7 +163,7 @@ write_recent(void)
   if ((rf = ws_fopen(rf_path, "w")) == NULL) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't open recent file\n\"%s\": %s.", rf_path,
-      strerror(errno));
+      g_strerror(errno));
     g_free(rf_path);
     return FALSE;
   }
@@ -277,7 +277,7 @@ write_profile_recent(void)
   if (create_persconffile_dir(&pf_dir_path) == -1) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't create directory\n\"%s\"\nfor recent file: %s.", pf_dir_path,
-      strerror(errno));
+      g_strerror(errno));
      g_free(pf_dir_path);
      return FALSE;
   }
@@ -286,7 +286,7 @@ write_profile_recent(void)
   if ((rf = ws_fopen(rf_path, "w")) == NULL) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't open recent file\n\"%s\": %s.", rf_path,
-      strerror(errno));
+      g_strerror(errno));
     g_free(rf_path);
     return FALSE;
   }
index ff7d28343a03eb1da0829c968d073c79fc2b0f43..11a4f7dc9966e9673997ba480a4b410d6f3586c7 100644 (file)
@@ -299,18 +299,13 @@ display_queued_messages(void)
 gpointer
 vsimple_dialog(ESD_TYPE_E type, gint btn_mask, const gchar *msg_format, va_list ap)
 {
-  gchar             *vmessage;
   gchar             *message;
   queued_message_t *queued_message;
   GtkWidget        *win;
   GdkWindowState state = 0;
 
   /* Format the message. */
-  vmessage = g_strdup_vprintf(msg_format, ap);
-
-  /* convert character encoding from locale to UTF8 (using iconv) */
-  message = g_locale_to_utf8(vmessage, -1, NULL, NULL, NULL);
-  g_free(vmessage);
+  message = g_strdup_vprintf(msg_format, ap);
 
   if (top_level != NULL) {
     state = gdk_window_get_state(top_level->window);
index b2769cc8816b03cf8dbef5d0a257a18ad6006b19..44c942275803f69b96c0e1cff425cd83c253ca86 100644 (file)
@@ -120,12 +120,12 @@ static void text_page_set_text(GtkWidget *page, const char *absolute_path)
     }
     if(ferror(text_file)) {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Error reading file \"%s\": %s",
-                    absolute_path, strerror(errno));
+                    absolute_path, g_strerror(errno));
     }
     fclose(text_file);
   } else {
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open file \"%s\": %s",
-                    absolute_path, strerror(errno));
+                    absolute_path, g_strerror(errno));
   }
 }
 
index 1d970def01c821a48c9b8593ff7ba91e3e8dde38..70b4b58ff76d67cb1271ebd8a8257dff550437c7 100644 (file)
@@ -329,7 +329,7 @@ main(int argc, char *argv[])
     out_fd = ws_open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
     if (out_fd == -1) {
       fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n",
-              out_filename, strerror(errno));
+              out_filename, g_strerror(errno));
       exit(1);
     }
   }
index 4422a770e91b624ad7b653e11f7f035f52ed49d8..9edb79e27428539cf103dfd48bdedc5c737d59a1 100644 (file)
 /* Define to 1 if you have the `stpcpy' function. */
 #define HAVE_STPCPY 1
 
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
 /* Define to 1 if you have the <strings.h> header file. */
 #define HAVE_STRINGS_H 1
 
index b58e9cf3b26abec268934442c986731780995d20..e9fa38d71ac26b7d5cf0283282b3aa90ac04a9dc 100644 (file)
@@ -2906,7 +2906,7 @@ read_asn1_type_table(const char *filename)
 
        data = g_malloc(size);
        if (fread(data, size, 1, f) < 1) {
-               g_warning("error reading %s, %s", filename, strerror(errno));
+               g_warning("error reading %s, %s", filename, g_strerror(errno));
        }
        fclose(f);
 
index dd4646fcb6c5cb7c0638874c0a34cba542716fbf..4fb4b509e972f1e279d9fd30a29eee0c75fa9c6a 100644 (file)
@@ -182,7 +182,7 @@ blk_cmnt_stop  "*/"
                yy_switch_to_buffer(include_stack[--include_stack_ptr] );
 
                if (errno)
-                       g_string_append_printf(mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, strerror(errno) );
+                       g_string_append_printf(mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, g_strerror(errno) );
 
        } else {
 
@@ -292,7 +292,7 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) {
        yyin = ws_fopen(filename,"r");
 
        if (!yyin) {
-               g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, strerror(errno) );
+               g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, g_strerror(errno) );
                return FALSE;
        }
 
index 173fa0db1ef5a49823150ad4197ffaf917dc2bcb..c1f58f0bf53d9af3343f9c34551c6afeb33111c4 100644 (file)
--- a/randpkt.c
+++ b/randpkt.c
@@ -711,7 +711,7 @@ seed(void)
                if (errno != ENOENT) {
                        fprintf(stderr,
                            "randpkt: Could not open " RANDOM_DEV " for reading: %s\n",
-                           strerror(errno));
+                           g_strerror(errno));
                        exit(2);
                }
                goto fallback;
@@ -721,7 +721,7 @@ seed(void)
        if (ret == -1) {
                fprintf(stderr,
                    "randpkt: Could not read from " RANDOM_DEV ": %s\n",
-                   strerror(errno));
+                   g_strerror(errno));
                exit(2);
        }
        if ((size_t)ret != sizeof randomness) {
index 3d90e3267927e1eec0448135f0264c9a6a5b0155..4d2e0fef57bb6d1d4b31b424f5ca8ae1fb5165c2 100644 (file)
 # include <sys/stat.h>
 #endif
 
-#ifdef NEED_STRERROR_H
-#include "wsutil/strerror.h"
-#endif
-
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #else
@@ -274,7 +270,7 @@ raw_pipe_open(const char *pipe_name)
 #ifndef _WIN32
         if (ws_stat64(pipe_name, &pipe_stat) < 0) {
             fprintf(stderr, "rawshark: The pipe %s could not be checked: %s\n",
-                    pipe_name, strerror(errno));
+                    pipe_name, g_strerror(errno));
             return -1;
         }
         if (! S_ISFIFO(pipe_stat.st_mode)) {
@@ -293,7 +289,7 @@ raw_pipe_open(const char *pipe_name)
         rfd = ws_open(pipe_name, O_RDONLY | O_NONBLOCK, 0000 /* no creation so don't matter */);
         if (rfd == -1) {
             fprintf(stderr, "rawshark: \"%s\" could not be opened: %s\n",
-                    pipe_name, strerror(errno));
+                    pipe_name, g_strerror(errno));
             return -1;
         }
 #else /* _WIN32 */
@@ -348,7 +344,7 @@ raw_pipe_open(const char *pipe_name)
         rfd = _open_osfhandle((long) hPipe, _O_RDONLY);
         if (rfd == -1) {
             fprintf(stderr, "rawshark: \"%s\" could not be opened: %s\n",
-                    pipe_name, strerror(errno));
+                    pipe_name, g_strerror(errno));
             return -1;
         }
 #endif /* _WIN32 */
@@ -531,21 +527,21 @@ main(int argc, char *argv[])
     if (gpf_path != NULL) {
         if (gpf_open_errno != 0) {
             cmdarg_err("Can't open global preferences file \"%s\": %s.",
-                       pf_path, strerror(gpf_open_errno));
+                       pf_path, g_strerror(gpf_open_errno));
         }
         if (gpf_read_errno != 0) {
             cmdarg_err("I/O error reading global preferences file \"%s\": %s.",
-                       pf_path, strerror(gpf_read_errno));
+                       pf_path, g_strerror(gpf_read_errno));
         }
     }
     if (pf_path != NULL) {
         if (pf_open_errno != 0) {
             cmdarg_err("Can't open your preferences file \"%s\": %s.", pf_path,
-                       strerror(pf_open_errno));
+                       g_strerror(pf_open_errno));
         }
         if (pf_read_errno != 0) {
             cmdarg_err("I/O error reading your preferences file \"%s\": %s.",
-                       pf_path, strerror(pf_read_errno));
+                       pf_path, g_strerror(pf_read_errno));
         }
         g_free(pf_path);
         pf_path = NULL;
@@ -560,11 +556,11 @@ main(int argc, char *argv[])
     if (gdp_path != NULL) {
         if (gdp_open_errno != 0) {
             cmdarg_err("Could not open global disabled protocols file\n\"%s\": %s.",
-                       gdp_path, strerror(gdp_open_errno));
+                       gdp_path, g_strerror(gdp_open_errno));
         }
         if (gdp_read_errno != 0) {
             cmdarg_err("I/O error reading global disabled protocols file\n\"%s\": %s.",
-                       gdp_path, strerror(gdp_read_errno));
+                       gdp_path, g_strerror(gdp_read_errno));
         }
         g_free(gdp_path);
     }
@@ -572,12 +568,12 @@ main(int argc, char *argv[])
         if (dp_open_errno != 0) {
             cmdarg_err(
                 "Could not open your disabled protocols file\n\"%s\": %s.", dp_path,
-                strerror(dp_open_errno));
+                g_strerror(dp_open_errno));
         }
         if (dp_read_errno != 0) {
             cmdarg_err(
                 "I/O error reading your disabled protocols file\n\"%s\": %s.", dp_path,
-                strerror(dp_read_errno));
+                g_strerror(dp_read_errno));
         }
         g_free(dp_path);
     }
@@ -1546,7 +1542,7 @@ show_print_file_io_error(int err)
 
         default:
             cmdarg_err("An error occurred while printing packets: %s.",
-                       strerror(err));
+                       g_strerror(err));
             break;
     }
 }
@@ -1622,7 +1618,7 @@ static void
 read_failure_message(const char *filename, int err)
 {
     cmdarg_err("An error occurred while reading from the file \"%s\": %s.",
-               filename, strerror(err));
+               filename, g_strerror(err));
 }
 
 /*
@@ -1632,7 +1628,7 @@ static void
 write_failure_message(const char *filename, int err)
 {
     cmdarg_err("An error occurred while writing to the file \"%s\": %s.",
-               filename, strerror(err));
+               filename, g_strerror(err));
 }
 
 /*
index 18df1c917b591cd0d8e69d845877484fa52def03..daf1dacece82c6683efeb3a3240d7cc464cc20c1 100644 (file)
@@ -1316,7 +1316,7 @@ parse_options (int argc, char *argv[])
         input_file = ws_fopen(input_filename, "rb");
         if (!input_file) {
             fprintf(stderr, "Cannot open file [%s] for reading: %s\n",
-                    input_filename, strerror(errno));
+                    input_filename, g_strerror(errno));
             exit(-1);
         }
     } else {
@@ -1329,7 +1329,7 @@ parse_options (int argc, char *argv[])
         output_file = ws_fopen(output_filename, "wb");
         if (!output_file) {
             fprintf(stderr, "Cannot open file [%s] for writing: %s\n",
-                    output_filename, strerror(errno));
+                    output_filename, g_strerror(errno));
             exit(-1);
         }
     } else {
index 7d71be815d2cbb93e2dffd8bac23b1c11ac34e41..3e0944daa848d396971c679c882b52a97432f420 100755 (executable)
@@ -96,6 +96,7 @@ my %APIs = (
                'g_strdown',
                'g_string_up',
                'g_string_down',
+               'strerror',     # use g_strerror
                # Use the ws_* version of these:
                # (Necessary because on Windows we use UTF8 for throughout the code
                # so we must tweak that to UTF16 before operating on the file.  Code
@@ -115,7 +116,7 @@ my %APIs = (
 
        # APIs that SHOULD NOT be used in Wireshark (any more)
        'deprecated' => { 'count_errors' => 1, 'functions' => [
-               'perror',                                       # Use strerror() and report messages in whatever
+               'perror',                                       # Use g_strerror() and report messages in whatever
                                                                #  fashion is appropriate for the code in question.
                'ctime',                                        # Use abs_time_secs_to_str()
                'dissector_add',                                # Use dissector_add_uint()
index 466ce2a0cb427ab5e670a598387c90bb0a1c25c8..1a3d761f40a2b7b12846ab225a96ff405530e47c 100644 (file)
--- a/tshark.c
+++ b/tshark.c
 # include <sys/stat.h>
 #endif
 
-#ifdef NEED_STRERROR_H
-#include "wsutil/strerror.h"
-#endif
-
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #else
@@ -1019,21 +1015,21 @@ main(int argc, char *argv[])
   if (gpf_path != NULL) {
     if (gpf_open_errno != 0) {
       cmdarg_err("Can't open global preferences file \"%s\": %s.",
-              pf_path, strerror(gpf_open_errno));
+              pf_path, g_strerror(gpf_open_errno));
     }
     if (gpf_read_errno != 0) {
       cmdarg_err("I/O error reading global preferences file \"%s\": %s.",
-              pf_path, strerror(gpf_read_errno));
+              pf_path, g_strerror(gpf_read_errno));
     }
   }
   if (pf_path != NULL) {
     if (pf_open_errno != 0) {
       cmdarg_err("Can't open your preferences file \"%s\": %s.", pf_path,
-              strerror(pf_open_errno));
+              g_strerror(pf_open_errno));
     }
     if (pf_read_errno != 0) {
       cmdarg_err("I/O error reading your preferences file \"%s\": %s.",
-              pf_path, strerror(pf_read_errno));
+              pf_path, g_strerror(pf_read_errno));
     }
     g_free(pf_path);
     pf_path = NULL;
@@ -1048,11 +1044,11 @@ main(int argc, char *argv[])
   if (gdp_path != NULL) {
     if (gdp_open_errno != 0) {
       cmdarg_err("Could not open global disabled protocols file\n\"%s\": %s.",
-                 gdp_path, strerror(gdp_open_errno));
+                 gdp_path, g_strerror(gdp_open_errno));
     }
     if (gdp_read_errno != 0) {
       cmdarg_err("I/O error reading global disabled protocols file\n\"%s\": %s.",
-                 gdp_path, strerror(gdp_read_errno));
+                 gdp_path, g_strerror(gdp_read_errno));
     }
     g_free(gdp_path);
   }
@@ -1060,12 +1056,12 @@ main(int argc, char *argv[])
     if (dp_open_errno != 0) {
       cmdarg_err(
         "Could not open your disabled protocols file\n\"%s\": %s.", dp_path,
-        strerror(dp_open_errno));
+        g_strerror(dp_open_errno));
     }
     if (dp_read_errno != 0) {
       cmdarg_err(
         "I/O error reading your disabled protocols file\n\"%s\": %s.", dp_path,
-        strerror(dp_read_errno));
+        g_strerror(dp_read_errno));
     }
     g_free(dp_path);
   }
@@ -3522,7 +3518,7 @@ show_print_file_io_error(int err)
 
   default:
     cmdarg_err("An error occurred while printing packets: %s.",
-      strerror(err));
+      g_strerror(err));
     break;
   }
 }
@@ -3665,7 +3661,7 @@ static void
 read_failure_message(const char *filename, int err)
 {
   cmdarg_err("An error occurred while reading from the file \"%s\": %s.",
-          filename, strerror(err));
+          filename, g_strerror(err));
 }
 
 /*
@@ -3675,7 +3671,7 @@ static void
 write_failure_message(const char *filename, int err)
 {
   cmdarg_err("An error occurred while writing to the file \"%s\": %s.",
-          filename, strerror(err));
+          filename, g_strerror(err));
 }
 
 /*
index 64b6f4e44e239ed4b4bf418789ac20f2374dfae9..f5b2b225d346dea9a2bc0a750a085741eb4d6799 100644 (file)
@@ -363,7 +363,7 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
         */
        if (uname(&name) < 0) {
                g_string_append_printf(str, "unknown OS version (uname failed - %s)",
-                   strerror(errno));
+                   g_strerror(errno));
                return;
        }
 
index 4bf011e15ab65eab68787565683b5a5f756476f2..fcd66ea50c4088d7e7e14c43bc14c9dd9aa3743d 100644 (file)
@@ -622,7 +622,7 @@ const char
                        return "Unknown reason";
                return wtap_errlist[wtap_errlist_index];
        } else
-               return strerror(err);
+               return g_strerror(err);
 }
 
 /* Close only the sequential side, freeing up memory it uses.
index 7e6d80f8fae19decf60bbeb0f7e33af030438527..25eabb1d64fb4ccb310e0fc9bc9de7f229fbb659 100644 (file)
@@ -33,7 +33,6 @@ set(WSUTIL_FILES
 #              @INET_ATON_LO@  # inet_aton.c
 #              @INET_NTOP_LO@  # inet_ntop.c
 #              @INET_PTON_LO@  # inet_pton.c
-#              @STRERROR_LO@   # strerror.c
 #              @STRNCASECMP_LO@ # strncasecmp.c
 #              @STRPTIME_LO@   # strptime.c
   mpeg-audio.c
index 82a88aa655d948a0ab5f9e388feebf60f19a4b3a..8688c7376c5aa900b2e22b0b7183388e6b68cf0d 100644 (file)
@@ -54,12 +54,6 @@ else
 def_sym_filter_symbols += || /^ws_inet_pton/
 endif
 
-if NEED_STRERROR_LO
-wsutil_optional_objects += @STRERROR_LO@
-else
-def_sym_filter_symbols += || /^strerror/
-endif
-
 if NEED_STRNCASECMP_LO
 wsutil_optional_objects += @STRNCASECMP_LO@
 else
@@ -98,8 +92,6 @@ EXTRA_libwsutil_la_SOURCES=   \
        inet_ntop.c             \
        inet_pton.c             \
        inet_v6defs.h           \
-       strerror.c              \
-       strerror.h              \
        strncasecmp.c           \
        strptime.c              \
        strptime.h              \
diff --git a/wsutil/strerror.c b/wsutil/strerror.c
deleted file mode 100644 (file)
index 81e66e5..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* strerror.c
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#include "strerror.h"
-#include <glib.h>
-
-/*
- * Version of "strerror()", for the benefit of OSes that don't have it
- * (e.g., SunOS 4.x).
- */
-char *
-strerror(int errnum)
-{
-       extern int sys_nerr;
-       extern char *sys_errlist[];
-       static char errbuf[5+1+11+1];   /* "Error %d" */
-
-       if (errnum < 0 || errnum >= sys_nerr) {
-               g_snprintf(errbuf, 18, "Error %d", errnum);
-               return errbuf;
-       } else
-               return sys_errlist[errnum];
-}
diff --git a/wsutil/strerror.h b/wsutil/strerror.h
deleted file mode 100644 (file)
index 423655b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* strerror.h
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __STRERROR_H__
-#define __STRERROR_H__
-
-/*
- * Version of "strerror()", for the benefit of OSes that don't have it
- * (e.g., SunOS 4.x).
- */
-extern char *strerror(int);
-
-#endif