summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/parsenfsfh.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2002-06-21 00:49:02 +0000
committerfenner <fenner@FreeBSD.org>2002-06-21 00:49:02 +0000
commit6d9538de202e4b8787f1b1a2ee8dce6273a43dc2 (patch)
treecf4df09e1e89ebd11358792543230083e577ad0f /contrib/tcpdump/parsenfsfh.c
parentd832be42ce7cc0a492cddc15e8429bc29fb46462 (diff)
downloadFreeBSD-src-6d9538de202e4b8787f1b1a2ee8dce6273a43dc2.zip
FreeBSD-src-6d9538de202e4b8787f1b1a2ee8dce6273a43dc2.tar.gz
Merge tcpdump 3.7.1
MFC after: 2 weeks
Diffstat (limited to 'contrib/tcpdump/parsenfsfh.c')
-rw-r--r--contrib/tcpdump/parsenfsfh.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/contrib/tcpdump/parsenfsfh.c b/contrib/tcpdump/parsenfsfh.c
index 6712e49..f93321f 100644
--- a/contrib/tcpdump/parsenfsfh.c
+++ b/contrib/tcpdump/parsenfsfh.c
@@ -1,4 +1,37 @@
/*
+ * Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation,
+ * Western Research Laboratory. All rights reserved.
+ * Copyright (c) 2001 Compaq Computer Corporation. All rights reserved.
+ *
+ * Permission to use, copy, and modify this software and its
+ * documentation is hereby granted only under the following terms and
+ * conditions. Both the above copyright notice and this permission
+ * notice must appear in all copies of the software, derivative works
+ * or modified versions, and any portions thereof, and both notices
+ * must appear in supporting documentation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND COMPAQ COMPUTER CORPORATION
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+ * EVENT SHALL COMPAQ COMPUTER CORPORATION BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
* parsenfsfh.c - portable parser for NFS file handles
* uses all sorts of heuristics
*
@@ -11,7 +44,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.18 2000/07/01 03:39:00 assar Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.23 2001/09/17 21:57:53 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -85,8 +118,8 @@ register caddr_t *fh;
int len;
my_fsid *fsidp;
ino_t *inop;
-char **osnamep; /* if non-NULL, return OS name here */
-char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */
+const char **osnamep; /* if non-NULL, return OS name here */
+const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */
int ourself; /* true if file handle was generated on this host */
{
register unsigned char *fhp = (unsigned char *)fh;
@@ -371,17 +404,15 @@ int ourself; /* true if file handle was generated on this host */
case FHT_UNKNOWN:
#ifdef DEBUG
/* XXX debugging */
- int i;
for (i = 0; i < 32; i++)
(void)fprintf(stderr, "%x.", fhp[i]);
(void)fprintf(stderr, "\n");
#endif
- /* XXX for now, give "bogus" values to aid debugging */
-
/* Save the actual handle, so it can be display with -u */
for (i = 0; i < 32; i++)
- (void)sprintf(&(fsidp->Opaque_Handle[i*2]), "%.2X", fhp[i]);
+ (void)snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X", fhp[i]);
+ /* XXX for now, give "bogus" values to aid debugging */
fsidp->fsid_code = 0;
fsidp->Fsid_dev.Minor = 257;
fsidp->Fsid_dev.Major = 257;
OpenPOWER on IntegriCloud