]> git.pld-linux.org Git - packages/arpwatch.git/blame - arpwatch-debian_24from_field.patch
- build fix found, but i don't know how to grab diff from it
[packages/arpwatch.git] / arpwatch-debian_24from_field.patch
CommitLineData
e2fb63d0
TP
1Index: arpwatch/Makefile.in
2diff -u arpwatch/Makefile.in:1.1.1.1 arpwatch/Makefile.in:1.1.1.1.30.1
3--- arpwatch/Makefile.in:1.1.1.1 Tue Apr 17 13:31:36 2001
4+++ arpwatch/Makefile.in Thu Aug 12 15:10:44 2004
5@@ -65,7 +65,7 @@
6 @rm -f $@
7 $(CC) $(CFLAGS) -c $(srcdir)/$*.c
8
9-CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c setsignal.c
10+CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c localhost.c setsignal.c
11 WSRC = arpwatch.c
12 SSRC = arpsnmp.c
13 GENSRC = version.c
14@@ -77,7 +77,7 @@
15 OBJ = $(WSRC:.c=.o) $(SSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
16 WOBJ = $(WSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
17 SOBJ = $(SSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
18-HDR = arpwatch.h db.h dns.h ec.h file.h machdep.h report.h setsignal.h
19+HDR = arpwatch.h db.h dns.h ec.h file.h machdep.h report.h localhost.h setsignal.h
20
21 TAGHDR = \
22 /usr/include/net/if.h \
23Index: arpwatch/localhost.c
24diff -u /dev/null arpwatch/localhost.c:1.1.2.1
25--- /dev/null Sat Aug 14 03:19:35 2004
26+++ arpwatch/localhost.c Fri Aug 13 01:51:30 2004
27@@ -0,0 +1,70 @@
28+/* A slightly more convenient wrapper for gethostname
29+
30+ Copyright (C) 1996 Free Software Foundation, Inc.
31+
32+ Written by Miles Bader <miles@gnu.ai.mit.edu>
33+
34+ This program is free software; you can redistribute it and/or
35+ modify it under the terms of the GNU General Public License as
36+ published by the Free Software Foundation; either version 2, or (at
37+ your option) any later version.
38+
39+ This program is distributed in the hope that it will be useful, but
40+ WITHOUT ANY WARRANTY; without even the implied warranty of
41+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42+ General Public License for more details.
43+
44+ You should have received a copy of the GNU General Public License
45+ along with this program; if not, write to the Free Software
46+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
47+
48+#ifdef HAVE_CONFIG_H
49+#include <config.h>
50+#endif
51+
52+#include <unistd.h>
53+#include <malloc.h>
54+#include <stdlib.h>
55+#include <string.h>
56+#include <errno.h>
57+
58+#include "localhost.h"
59+/* Return the name of the localhost. This is just a wrapper for gethostname,
60+ which takes care of allocating a big enough buffer, and caches the result
61+ after the first call (so the result should be copied before modification).
62+ If something goes wrong, 0 is returned, and errno set. */
63+char *
64+localhost (void)
65+{
66+ static char *buf = 0;
67+ static size_t buf_len = 0;
68+ int myerror = 0;
69+
70+ if (! buf) {
71+ do {
72+ errno = 0;
73+ if (buf) {
74+ buf_len += buf_len;
75+ buf = realloc (buf, buf_len);
76+ } else {
77+ buf_len = 128; /* Initial guess */
78+ buf = malloc (buf_len);
79+ }
80+ if (! buf) {
81+ errno = ENOMEM;
82+ return 0;
83+ }
84+ } while ( (
85+ (myerror = gethostname(buf, buf_len)) == 0
86+ && !memchr (buf, '\0', buf_len))
87+ || errno == ENAMETOOLONG
88+ );
89+
90+ if (myerror) {
91+ /* gethostname failed, abort. */
92+ free (buf);
93+ buf = "(unknown host)";
94+ }
95+ }
96+ return buf;
97+}
98Index: arpwatch/localhost.h
99diff -u /dev/null arpwatch/localhost.h:1.1.2.1
100--- /dev/null Sat Aug 14 03:19:35 2004
101+++ arpwatch/localhost.h Fri Aug 13 01:51:30 2004
102@@ -0,0 +1 @@
103+char * localhost(void);
104Index: arpwatch/report.c
105diff -u arpwatch/report.c:1.1.1.1 arpwatch/report.c:1.1.1.1.30.2
106--- arpwatch/report.c:1.1.1.1 Tue Apr 17 13:31:37 2001
107+++ arpwatch/report.c Fri Aug 13 01:49:30 2004
108@@ -67,6 +67,7 @@
109 #include "report.h"
110 #include "setsignal.h"
111 #include "util.h"
112+#include "localhost.h"
113
114 #define PLURAL(n) ((n) == 1 || (n) == -1 ? "" : "s")
115
116@@ -300,7 +301,7 @@
117 syslog(LOG_ERR, "unlink(%s): %m", tempfile);
118 }
119
120- (void)fprintf(f, "From: %s\n", watchee);
121+ (void)fprintf(f, "From: arpwatch (Arpwatch %s)\n", localhost());
122 (void)fprintf(f, "To: %s\n", watcher);
123 hn = gethname(a);
124 if (!isdigit(*hn))
This page took 0.078674 seconds and 4 git commands to generate.