add extra sanity checks in madwifi
[openwrt.git] / package / br2684ctl / patches / 100-debian.patch
1 Index: br2684ctl-20040226.orig/br2684ctl.c
2 ===================================================================
3 --- br2684ctl-20040226.orig.orig/br2684ctl.c 2007-06-04 13:22:22.142489112 +0200
4 +++ br2684ctl-20040226.orig/br2684ctl.c 2007-06-04 13:22:22.213478320 +0200
5 @@ -3,6 +3,8 @@
6 #include <unistd.h>
7 #include <errno.h>
8 #include <sys/ioctl.h>
9 +#include <sys/types.h>
10 +#include <signal.h>
11 #include <string.h>
12 #include <syslog.h>
13 #include <atm.h>
14 @@ -22,9 +24,9 @@
15 */
16
17
18 -#define LOG_NAME "RFC1483/2684 bridge"
19 -#define LOG_OPTION LOG_PERROR
20 -#define LOG_FACILITY LOG_LOCAL0
21 +#define LOG_NAME "br2684ctl"
22 +#define LOG_OPTION LOG_PERROR|LOG_PID
23 +#define LOG_FACILITY LOG_LOCAL2
24
25
26 int lastsock, lastitf;
27 @@ -39,10 +41,16 @@
28
29 void exitFunc(void)
30 {
31 - syslog (LOG_PID,"Daemon terminated\n");
32 + syslog (LOG_NOTICE,"Daemon terminated\n");
33 }
34
35
36 +void int_signal(int dummy)
37 +{
38 + syslog (LOG_INFO,"Killed by a signal\n");
39 + exit(0);
40 +}
41 +
42 int create_pidfile(int num)
43 {
44 FILE *pidfile = NULL;
45 @@ -80,7 +88,7 @@
46 err=ioctl (lastsock, ATM_NEWBACKENDIF, &ni);
47
48 if (err == 0)
49 - syslog(LOG_INFO, "Interface \"%s\" created sucessfully\n",ni.ifname);
50 + syslog(LOG_NOTICE, "Interface \"%s\" created sucessfully\n",ni.ifname);
51 else
52 syslog(LOG_INFO, "Interface \"%s\" could not be created, reason: %s\n",
53 ni.ifname,
54 @@ -112,7 +120,7 @@
55 addr.sap_addr.vpi = 0;
56 addr.sap_addr.vci = vci;
57 #endif
58 - syslog(LOG_INFO,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf,
59 + syslog(LOG_NOTICE,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf,
60 addr.sap_addr.vpi,
61 addr.sap_addr.vci,
62 encap?"VC mux":"LLC");
63 @@ -261,11 +269,13 @@
64 }
65
66 create_pidfile(itfnum);
67 + signal(SIGINT, int_signal);
68 + signal(SIGTERM, int_signal);
69
70 syslog (LOG_INFO, "RFC 1483/2684 bridge daemon started\n");
71 atexit (exitFunc);
72
73 - while (1) sleep(30); /* to keep the sockets... */
74 + while (1) pause(); /* to keep the sockets... */
75 return 0;
76 }
77
78 Index: br2684ctl-20040226.orig/Makefile
79 ===================================================================
80 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
81 +++ br2684ctl-20040226.orig/Makefile 2007-06-04 13:22:22.215478016 +0200
82 @@ -0,0 +1,13 @@
83 +OPTS := -O2
84 +CFLAGS := -Wall -g
85 +LIBS := -latm
86 +
87 +all: br2684ctl
88 +
89 +br2684ctl: br2684ctl.c
90 + $(CC) $(OPTS) $(CFLAGS) $(LIBS) $< -o $@
91 +
92 +distclean: clean
93 +clean:
94 + rm -f br2684ctl
95 +
This page took 0.04555 seconds and 5 git commands to generate.