openbsd-ports/net/arpcatch/patches/patch-arpcatch_c
2022-03-11 19:45:43 +00:00

52 lines
1.1 KiB
Plaintext

--- arpcatch.c.orig Thu Aug 21 18:57:01 1997
+++ arpcatch.c Wed Feb 20 13:20:11 2002
@@ -11,13 +11,13 @@ int debug = 0;
int defer = 0;
int main(int argc, char **argv) {
- char c;
+ int c;
char *configfile = DEFAULT_CONFIGFILE;
char *device = DEFAULT_DEVICE;
table_t *at;
int fd;
- while((c = getopt(argc, argv, "di:f:")) != EOF) {
+ while((c = getopt(argc, argv, "di:f:")) != -1) {
switch(c) {
case 'd':
debug++;
@@ -37,6 +37,7 @@ int main(int argc, char **argv) {
}
}
+ printf("Starting on %s interface\n",device);
if(!(at = read_config(configfile))) {
perror("config file read");
exit(errno);
@@ -50,6 +51,7 @@ int main(int argc, char **argv) {
read_loop(fd, at);
perror("read");
+return 1;
}
/* needs cleaning up */
@@ -63,7 +65,6 @@ int read_loop(int fd, table_t *at) {
struct ether_addr *ea;
struct ether_arp *ah;
- struct in_addr foo;
for(;;) {
struct in_addr ia;
@@ -129,7 +130,7 @@ int init_bpf(char *device) {
fd = bpf_open(device);
if(fd < 0) {
- perror("bpf open");
+ fprintf(stderr,"Error initializing bpf filter\nExiting..\n");
exit(errno);
}