Don't check for "(null)" as the result of a printf operation; don't pass
in a null pointer to %s in the first place! Not all printf implementations necessarily emit "(null)" in that case; perhaps GLib's does, but we shouldn't even depend on that - we should, instead, at least print something semi-useful in that case (the link-layer type's numerical value). Fix syntax errors in the "no libpcap" case. svn path=/trunk/; revision=37910
This commit is contained in:
parent
053c583fda
commit
fc581f9865
|
@ -112,6 +112,9 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
GtkTreeIter iter;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
#ifdef HAVE_LIBPCAP
|
||||
char *dl_description;
|
||||
#endif
|
||||
static const char *titles[] = { "Traffic", "Captured", "Displayed", "Marked" };
|
||||
|
||||
gchar string_buff[SUM_STR_MAX];
|
||||
|
@ -281,14 +284,15 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
|||
g_snprintf(string_buff3, SUM_STR_MAX, "unknown");
|
||||
}
|
||||
}
|
||||
g_snprintf(string_buff4, SUM_STR_MAX, "%s", pcap_datalink_val_to_description(iface.linktype));
|
||||
dl_description = pcap_datalink_val_to_description(iface.linktype);
|
||||
if (dl_description != NULL)
|
||||
g_snprintf(string_buff4, SUM_STR_MAX, "%s", dl_description);
|
||||
else
|
||||
g_snprintf(string_buff4, SUM_STR_MAX, "DLT %d", iface.linktype);
|
||||
#else
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "unknown")
|
||||
g_snprintf(string_buff4, SUM_STR_MAX, "unknown")
|
||||
g_snprintf(string_buff3, SUM_STR_MAX, "unknown");
|
||||
g_snprintf(string_buff4, SUM_STR_MAX, "unknown");
|
||||
#endif
|
||||
if (strcmp(string_buff4, "(null)") == 0) {
|
||||
g_snprintf(string_buff4, SUM_STR_MAX, "unknown");
|
||||
}
|
||||
if (iface.has_snap) {
|
||||
g_snprintf(string_buff5, SUM_STR_MAX, "%u bytes", iface.snap);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue