aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index b02320a..6c72c38 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,5 @@
1/* This file is part of IPACCT 1/* This file is part of IPACCT
2 Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Sergey Poznyakoff 2 Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2008 Sergey Poznyakoff
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17/* $Id: main.c,v 1.9 2005/05/20 12:59:53 gray Exp $ */ 17/* $Id: main.c,v 1.10 2008/07/07 13:27:02 gray Exp $ */
18#if defined(HAVE_CONFIG_H) 18#if defined(HAVE_CONFIG_H)
19# include <config.h> 19# include <config.h>
20#endif 20#endif
@@ -126,19 +126,19 @@ parse_opt (key, arg, state)
126 dump_bytecode++; 126 dump_bytecode++;
127 break; 127 break;
128 case 'c': 128 case 'c':
129 profile = optarg; 129 profile = arg;
130 break; 130 break;
131 case 'f': 131 case 'f':
132 foreground++; 132 foreground++;
133 break; 133 break;
134 case 'F': 134 case 'F':
135 infile = optarg; 135 infile = arg;
136 break; 136 break;
137 case 'i': 137 case 'i':
138 device = optarg; 138 device = arg;
139 break; 139 break;
140 case 'l': 140 case 'l':
141 log_name = optarg; 141 log_name = arg;
142 break; 142 break;
143 case 'O': 143 case 'O':
144 optimize_expr++; 144 optimize_expr++;
@@ -153,7 +153,7 @@ parse_opt (key, arg, state)
153 syntax_check++; 153 syntax_check++;
154 break; 154 break;
155 case 't': 155 case 't':
156 ttw = atoi(optarg); 156 ttw = atoi(arg);
157 if (ttw <= 0) 157 if (ttw <= 0)
158 die(1, "invalid timeslice value (%d)", ttw); 158 die(1, "invalid timeslice value (%d)", ttw);
159 break; 159 break;
@@ -170,7 +170,7 @@ parse_opt (key, arg, state)
170 fixed_clocks++; 170 fixed_clocks++;
171 break; 171 break;
172 case 'u': 172 case 'u':
173 user = optarg; 173 user = arg;
174 break; 174 break;
175 default: 175 default:
176 return ARGP_ERR_UNKNOWN; 176 return ARGP_ERR_UNKNOWN;
@@ -313,8 +313,9 @@ main(argc, argv)
313 int c, type; 313 int c, type;
314 pcap_handler callback; 314 pcap_handler callback;
315 pid_t pid; 315 pid_t pid;
316 int index;
316 317
317 if (argp_parse(&argp, argc, argv, 0, 0, NULL)) 318 if (argp_parse(&argp, argc, argv, 0, &index, NULL))
318 exit(1); 319 exit(1);
319 320
320 read_profile(profile); 321 read_profile(profile);
@@ -326,11 +327,11 @@ main(argc, argv)
326 alloc_snap_buffer(); 327 alloc_snap_buffer();
327 328
328 if (infile) { 329 if (infile) {
329 if (optind < argc) 330 if (index < argc)
330 die(1, "excess arguments after %s", argv[optind]); 331 die(1, "excess arguments after %s", argv[index]);
331 expr = read_expr(infile); 332 expr = read_expr(infile);
332 } else if (optind < argc) 333 } else if (index < argc)
333 expr = copy_argv(argc, argv, optind); 334 expr = copy_argv(argc, argv, index);
334 335
335 336
336 pcap = init(device, expr); 337 pcap = init(device, expr);
@@ -408,7 +409,7 @@ init(device, cmdbuf)
408 409
409 setuid(getuid()); 410 setuid(getuid());
410 411
411 bzero((char *) &bpfcode, sizeof(bpfcode)); 412 memset(&bpfcode, 0, sizeof(bpfcode));
412 413
413 if (pcap_compile(pd, &bpfcode, cmdbuf, optimize_expr, netmask) < 0) 414 if (pcap_compile(pd, &bpfcode, cmdbuf, optimize_expr, netmask) < 0)
414 die(1, pcap_geterr(pd)); 415 die(1, pcap_geterr(pd));

Return to:

Send suggestions and report system problems to the System administrator.