forked from osmocom/wireshark
Add routines to return "Please report this as a bug" message strings.
(Routines, so that if we internationalize strings not in the Qt code, this can return the appropriately translated version.) Change-Id: I1c169d79acde2f0545af7af2a737883d58f52509 Reviewed-on: https://code.wireshark.org/review/32549 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
2cb4d315ad
commit
4ad6f2a813
|
@ -67,6 +67,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#include <wsutil/file_util.h>
|
#include <wsutil/file_util.h>
|
||||||
|
#include <wsutil/please_report_bug.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -85,14 +86,6 @@
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Standard secondary message for unexpected errors.
|
|
||||||
*/
|
|
||||||
static const char please_report[] =
|
|
||||||
"Please report this to the Wireshark developers.\n"
|
|
||||||
"https://bugs.wireshark.org/\n"
|
|
||||||
"(This is not a crash; please do not report it as such.)";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Given an interface name, find the "friendly name" and interface
|
* Given an interface name, find the "friendly name" and interface
|
||||||
* type for the interface.
|
* type for the interface.
|
||||||
|
@ -977,7 +970,8 @@ set_pcap_datalink(pcap_t *pcap_h, int datalink, char *name,
|
||||||
* tell the user to tell the Wireshark developers about it.
|
* tell the user to tell the Wireshark developers about it.
|
||||||
*/
|
*/
|
||||||
if (strstr(set_datalink_err_str, "is not one of the DLTs supported by this device") == NULL)
|
if (strstr(set_datalink_err_str, "is not one of the DLTs supported by this device") == NULL)
|
||||||
g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, please_report);
|
g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len,
|
||||||
|
"%s", please_report_bug());
|
||||||
else
|
else
|
||||||
secondary_errmsg[0] = '\0';
|
secondary_errmsg[0] = '\0';
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
23
dumpcap.c
23
dumpcap.c
|
@ -86,6 +86,7 @@
|
||||||
#include "wsutil/str_util.h"
|
#include "wsutil/str_util.h"
|
||||||
#include "wsutil/inet_addr.h"
|
#include "wsutil/inet_addr.h"
|
||||||
#include "wsutil/time_util.h"
|
#include "wsutil/time_util.h"
|
||||||
|
#include "wsutil/please_report_bug.h"
|
||||||
|
|
||||||
#include "caputils/ws80211_utils.h"
|
#include "caputils/ws80211_utils.h"
|
||||||
|
|
||||||
|
@ -326,14 +327,6 @@ typedef struct _pcap_queue_element {
|
||||||
u_char *pd;
|
u_char *pd;
|
||||||
} pcap_queue_element;
|
} pcap_queue_element;
|
||||||
|
|
||||||
/*
|
|
||||||
* Standard secondary message for unexpected errors.
|
|
||||||
*/
|
|
||||||
static const char please_report[] =
|
|
||||||
"Please report this to the Wireshark developers.\n"
|
|
||||||
"https://bugs.wireshark.org/\n"
|
|
||||||
"(This is not a crash; please do not report it as such.)";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This needs to be static, so that the SIGINT handler can clear the "go"
|
* This needs to be static, so that the SIGINT handler can clear the "go"
|
||||||
* flag and for saved_shb_idb_lock.
|
* flag and for saved_shb_idb_lock.
|
||||||
|
@ -2774,7 +2767,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
|
||||||
"Couldn't initialize Windows Sockets: error %d", err);
|
"Couldn't initialize Windows Sockets: error %d", err);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, please_report);
|
g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, please_report_bug());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3342,7 +3335,7 @@ capture_loop_dispatch(loop_data *ld,
|
||||||
if (sel_ret < 0 && errno != EINTR) {
|
if (sel_ret < 0 && errno != EINTR) {
|
||||||
g_snprintf(errmsg, errmsg_len,
|
g_snprintf(errmsg, errmsg_len,
|
||||||
"Unexpected error from select: %s", g_strerror(errno));
|
"Unexpected error from select: %s", g_strerror(errno));
|
||||||
report_capture_error(errmsg, please_report);
|
report_capture_error(errmsg, please_report_bug());
|
||||||
ld->go = FALSE;
|
ld->go = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3415,7 +3408,7 @@ capture_loop_dispatch(loop_data *ld,
|
||||||
if (sel_ret < 0 && errno != EINTR) {
|
if (sel_ret < 0 && errno != EINTR) {
|
||||||
g_snprintf(errmsg, errmsg_len,
|
g_snprintf(errmsg, errmsg_len,
|
||||||
"Unexpected error from select: %s", g_strerror(errno));
|
"Unexpected error from select: %s", g_strerror(errno));
|
||||||
report_capture_error(errmsg, please_report);
|
report_capture_error(errmsg, please_report_bug());
|
||||||
ld->go = FALSE;
|
ld->go = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3912,7 +3905,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
|
||||||
case INITFILTER_OTHER_ERROR:
|
case INITFILTER_OTHER_ERROR:
|
||||||
g_snprintf(errmsg, sizeof(errmsg), "Can't install filter (%s).",
|
g_snprintf(errmsg, sizeof(errmsg), "Can't install filter (%s).",
|
||||||
pcap_geterr(pcap_src->pcap_h));
|
pcap_geterr(pcap_src->pcap_h));
|
||||||
g_snprintf(secondary_errmsg, sizeof(secondary_errmsg), "%s", please_report);
|
g_snprintf(secondary_errmsg, sizeof(secondary_errmsg), "%s", please_report_bug());
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4164,7 +4157,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
|
||||||
} else {
|
} else {
|
||||||
g_snprintf(errmsg, sizeof(errmsg), "Error while capturing packets: %s",
|
g_snprintf(errmsg, sizeof(errmsg), "Error while capturing packets: %s",
|
||||||
cap_err_str);
|
cap_err_str);
|
||||||
report_capture_error(errmsg, please_report);
|
report_capture_error(errmsg, please_report_bug());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else if (pcap_src->from_cap_pipe && pcap_src->cap_pipe_err == PIPERR) {
|
} else if (pcap_src->from_cap_pipe && pcap_src->cap_pipe_err == PIPERR) {
|
||||||
|
@ -4236,7 +4229,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
|
||||||
g_snprintf(errmsg, sizeof(errmsg),
|
g_snprintf(errmsg, sizeof(errmsg),
|
||||||
"Can't get packet-drop statistics: %s",
|
"Can't get packet-drop statistics: %s",
|
||||||
pcap_geterr(pcap_src->pcap_h));
|
pcap_geterr(pcap_src->pcap_h));
|
||||||
report_capture_error(errmsg, please_report);
|
report_capture_error(errmsg, please_report_bug());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
report_packet_drops(received, pcap_dropped, pcap_src->dropped, pcap_src->flushed, stats->ps_ifdrop, interface_opts->display_name);
|
report_packet_drops(received, pcap_dropped, pcap_src->dropped, pcap_src->flushed, stats->ps_ifdrop, interface_opts->display_name);
|
||||||
|
@ -4348,7 +4341,7 @@ capture_loop_get_errmsg(char *errmsg, size_t errmsglen, char *secondary_errmsg,
|
||||||
fname, g_strerror(err));
|
fname, g_strerror(err));
|
||||||
}
|
}
|
||||||
g_snprintf(secondary_errmsg, (gulong)secondary_errmsglen,
|
g_snprintf(secondary_errmsg, (gulong)secondary_errmsglen,
|
||||||
"%s", please_report);
|
"%s", please_report_bug());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ set(WSUTIL_PUBLIC_HEADERS
|
||||||
nstime.h
|
nstime.h
|
||||||
os_version_info.h
|
os_version_info.h
|
||||||
pint.h
|
pint.h
|
||||||
|
please_report_bug.h
|
||||||
plugins.h
|
plugins.h
|
||||||
pow2.h
|
pow2.h
|
||||||
privileges.h
|
privileges.h
|
||||||
|
@ -102,6 +103,7 @@ set(WSUTIL_COMMON_FILES
|
||||||
nstime.c
|
nstime.c
|
||||||
cpu_info.c
|
cpu_info.c
|
||||||
os_version_info.c
|
os_version_info.c
|
||||||
|
please_report_bug.c
|
||||||
privileges.c
|
privileges.c
|
||||||
rsa.c
|
rsa.c
|
||||||
sober128.c
|
sober128.c
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* please_report_bug.c
|
||||||
|
* Routines returning strings to use when reporting a bug.
|
||||||
|
* They ask the user to report a bug to the Wireshark developers.
|
||||||
|
*
|
||||||
|
* Wireshark - Network traffic analyzer
|
||||||
|
* By Gerald Combs <gerald@wireshark.org>
|
||||||
|
* Copyright 1998 Gerald Combs
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "please_report_bug.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Long message, to use in alert boxes and printed messages.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
please_report_bug(void)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
"Please report this to the Wireshark developers.\n"
|
||||||
|
"https://bugs.wireshark.org/\n"
|
||||||
|
"(This is not a crash; please do not report it as such.)";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Short message, to use in status bar messages.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
please_report_bug_short(void)
|
||||||
|
{
|
||||||
|
return "Please report this to the Wireshark developers.";
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* please_report_bug.h
|
||||||
|
* Declarations of routines returning strings to use when reporting a bug.
|
||||||
|
* They ask the user to report a bug to the Wireshark developers.
|
||||||
|
*
|
||||||
|
* Wireshark - Network traffic analyzer
|
||||||
|
* By Gerald Combs <gerald@wireshark.org>
|
||||||
|
* Copyright 1998 Gerald Combs
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PLEASE_REPORT_BUG_H__
|
||||||
|
#define __PLEASE_REPORT_BUG_H__
|
||||||
|
|
||||||
|
#include "ws_symbol_export.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Long message, to use in alert boxes and printed messages.
|
||||||
|
*/
|
||||||
|
WS_DLL_PUBLIC const char *please_report_bug(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Short message, to use in status bar messages.
|
||||||
|
*/
|
||||||
|
WS_DLL_PUBLIC const char *please_report_bug_short(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __PLEASE_REPORT_BUG_H__ */
|
Loading…
Reference in New Issue