NetBSD Problem Report #41326

From www@NetBSD.org  Fri May  1 21:13:32 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id D562463C131
	for <gnats-bugs@gnats.netbsd.org>; Fri,  1 May 2009 21:13:31 +0000 (UTC)
Message-Id: <20090501211331.944C463B8A5@www.NetBSD.org>
Date: Fri,  1 May 2009 21:13:31 +0000 (UTC)
From: mmayer@redback.com
Reply-To: mmayer@redback.com
To: gnats-bugs@NetBSD.org
Subject: libpcap error message not printing useful information
X-Send-Pr-Version: www-1.0

>Number:         41326
>Category:       lib
>Synopsis:       libpcap error message not printing useful information
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 01 21:15:00 +0000 2009
>Originator:     Markus Mayer
>Release:        HEAD
>Organization:
Ericsson / Redback
>Environment:
>Description:
In two cases, libpcap will say that link-layer type "linktype" is not supported. However, "linktype" is always -1 at this point. Therefore, the error message will always complain about link-layer type -1 being unsupported.

It would be more helpful if "p->linktype" were being used instead of "linktype" in these two snprintf() calls.

>How-To-Repeat:

>Fix:
Index: savefile.c
===================================================================
RCS file: /cvsroot/src/dist/libpcap/savefile.c,v
retrieving revision 1.2
diff -u -r1.2 savefile.c
--- savefile.c  27 Feb 2006 15:55:30 -0000      1.2
+++ savefile.c  1 May 2009 21:12:39 -0000
@@ -1220,7 +1220,7 @@
        if (linktype == -1) {
                snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: link-layer type %d isn't supported in savefiles",
-                   fname, linktype);
+                   fname, p->linktype);
                return (NULL);
        }

@@ -1254,7 +1254,7 @@
        if (linktype == -1) {
                snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "stream: link-layer type %d isn't supported in savefiles",
-                   linktype);
+                   p->linktype);
                return (NULL);
        }

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.