summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-09-05 20:11:12 +0200
committerFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-09-05 20:20:57 +0200
commit71d0745d3d13d2c58126ebfeeeff0f1c8e745335 (patch)
treeebbbb1603a3f68d87c59c7b8927d352da87070ba
parent7f3d84de1debf4982944953defefc2f1d604b288 (diff)
downloadtcpdump-71d0745d3d13d2c58126ebfeeeff0f1c8e745335.tar.gz
Printers must use ndo_error() function (via ndo->ndo_error)
-rw-r--r--addrtoname.c4
-rw-r--r--netdissect.h4
-rw-r--r--print-atalk.c8
-rw-r--r--print-decnet.c10
-rw-r--r--print-tcp.c6
5 files changed, 18 insertions, 14 deletions
diff --git a/addrtoname.c b/addrtoname.c
index 551ebb90..96af9e11 100644
--- a/addrtoname.c
+++ b/addrtoname.c
@@ -1190,9 +1190,9 @@ dnaddr_string(netdissect_options *ndo, u_short dnaddr)
tp->addr = dnaddr;
tp->nxt = newhnamemem();
if (ndo->ndo_nflag)
- tp->name = dnnum_string(dnaddr);
+ tp->name = dnnum_string(ndo, dnaddr);
else
- tp->name = dnname_string(dnaddr);
+ tp->name = dnname_string(ndo, dnaddr);
return(tp->name);
}
diff --git a/netdissect.h b/netdissect.h
index 3b176b07..d69ad611 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -323,8 +323,8 @@ extern int unaligned_memcmp(const void *, const void *, size_t);
#define PLURAL_SUFFIX(n) \
(((n) != 1) ? "s" : "")
-extern const char *dnname_string(u_short);
-extern const char *dnnum_string(u_short);
+extern const char *dnname_string(netdissect_options *, u_short);
+extern const char *dnnum_string(netdissect_options *, u_short);
extern int mask2plen(uint32_t);
extern const char *tok2strary_internal(const char **, int, const char *, int);
diff --git a/print-atalk.c b/print-atalk.c
index 09c0ff43..6940d393 100644
--- a/print-atalk.c
+++ b/print-atalk.c
@@ -569,7 +569,8 @@ ataddr_string(netdissect_options *ndo,
tp->nxt = newhnamemem();
tp->name = strdup(nambuf);
if (tp->name == NULL)
- error("ataddr_string: strdup(nambuf)");
+ (*ndo->ndo_error)(ndo,
+ "ataddr_string: strdup(nambuf)");
}
fclose(fp);
}
@@ -588,7 +589,8 @@ ataddr_string(netdissect_options *ndo,
tp2->name, athost);
tp->name = strdup(nambuf);
if (tp->name == NULL)
- error("ataddr_string: strdup(nambuf)");
+ (*ndo->ndo_error)(ndo,
+ "ataddr_string: strdup(nambuf)");
return (tp->name);
}
@@ -600,7 +602,7 @@ ataddr_string(netdissect_options *ndo,
(void)snprintf(nambuf, sizeof(nambuf), "%d", atnet);
tp->name = strdup(nambuf);
if (tp->name == NULL)
- error("ataddr_string: strdup(nambuf)");
+ (*ndo->ndo_error)(ndo, "ataddr_string: strdup(nambuf)");
return (tp->name);
}
diff --git a/print-decnet.c b/print-decnet.c
index 37ff04b5..e94cc6b9 100644
--- a/print-decnet.c
+++ b/print-decnet.c
@@ -1295,7 +1295,7 @@ print_reason(netdissect_options *ndo,
}
const char *
-dnnum_string(u_short dnaddr)
+dnnum_string(netdissect_options *ndo, u_short dnaddr)
{
char *str;
size_t siz;
@@ -1304,13 +1304,13 @@ dnnum_string(u_short dnaddr)
str = (char *)malloc(siz = sizeof("00.0000"));
if (str == NULL)
- error("dnnum_string: malloc");
+ (*ndo->ndo_error)(ndo, "dnnum_string: malloc");
snprintf(str, siz, "%d.%d", area, node);
return(str);
}
const char *
-dnname_string(u_short dnaddr)
+dnname_string(netdissect_options *ndo, u_short dnaddr)
{
#ifdef HAVE_DNET_HTOA
struct dn_naddr dna;
@@ -1322,9 +1322,9 @@ dnname_string(u_short dnaddr)
if(dnname != NULL)
return (strdup(dnname));
else
- return(dnnum_string(dnaddr));
+ return(dnnum_string(ndo, dnaddr));
#else
- return(dnnum_string(dnaddr)); /* punt */
+ return(dnnum_string(ndo, dnaddr)); /* punt */
#endif
}
diff --git a/print-tcp.c b/print-tcp.c
index 0cc338d6..5374e8a4 100644
--- a/print-tcp.c
+++ b/print-tcp.c
@@ -287,7 +287,8 @@ tcp_print(netdissect_options *ndo,
th->nxt = (struct tcp_seq_hash6 *)
calloc(1, sizeof(*th));
if (th->nxt == NULL)
- error("tcp_print: calloc");
+ (*ndo->ndo_error)(ndo,
+ "tcp_print: calloc");
}
th->addr = tha;
if (rev)
@@ -343,7 +344,8 @@ tcp_print(netdissect_options *ndo,
th->nxt = (struct tcp_seq_hash *)
calloc(1, sizeof(*th));
if (th->nxt == NULL)
- error("tcp_print: calloc");
+ (*ndo->ndo_error)(ndo,
+ "tcp_print: calloc");
}
th->addr = tha;
if (rev)