diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-11-05 16:13:02 +0100 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2008-11-05 16:13:02 +0100 |
commit | 770eab0ce9b1716f5dc1c2bb63c4d708a172e621 (patch) | |
tree | c1acdaf284a5bfb9b90c7d2bc69e1db0294a5c62 | |
parent | a5429617f7baa33097dab2399e8f8c5e8c5443d1 (diff) | |
download | dovecot-antispam-770eab0ce9b1716f5dc1c2bb63c4d708a172e621.tar.gz dovecot-antispam-770eab0ce9b1716f5dc1c2bb63c4d708a172e621.tar.xz dovecot-antispam-770eab0ce9b1716f5dc1c2bb63c4d708a172e621.zip |
make args easier to understand
-rw-r--r-- | crm114-exec.c | 7 | ||||
-rw-r--r-- | dspam-exec.c | 5 |
2 files changed, 5 insertions, 7 deletions
diff --git a/crm114-exec.c b/crm114-exec.c index 360346b..7727409 100644 --- a/crm114-exec.c +++ b/crm114-exec.c @@ -33,8 +33,6 @@ static const char *reaver_binary = "/bin/false"; static char **extra_args = NULL; static int extra_args_num = 0; -#define FIXED_ARGS_NUM 2 - static int call_reaver(const char *signature, enum classification wanted) { pid_t pid; @@ -86,7 +84,8 @@ static int call_reaver(const char *signature, enum classification wanted) } else { int fd = open("/dev/null", O_RDONLY); char **argv; - int sz = sizeof(char *) * (FIXED_ARGS_NUM + extra_args_num + 1); + /* 2 fixed, extra, terminating NULL */ + int sz = sizeof(char *) * (2 + extra_args_num + 1); int i; argv = i_malloc(sz); @@ -112,7 +111,7 @@ static int call_reaver(const char *signature, enum classification wanted) argv[1] = (char *)class_arg; for (i = 0; i < extra_args_num; i++) - argv[i + FIXED_ARGS_NUM] = (char *)extra_args[i]; + argv[i + 2] = (char *)extra_args[i]; debugv(argv); diff --git a/dspam-exec.c b/dspam-exec.c index 2f37c36..b0316aa 100644 --- a/dspam-exec.c +++ b/dspam-exec.c @@ -33,8 +33,6 @@ static const char *dspam_binary = "/usr/bin/dspam"; static char **extra_args = NULL; static int extra_args_num = 0; -#define FIXED_ARGS_NUM 5 - static int call_dspam(const char *signature, enum classification wanted) { pid_t pid; @@ -103,7 +101,8 @@ static int call_dspam(const char *signature, enum classification wanted) } else { int fd = open("/dev/null", O_RDONLY); char **argv; - int sz = sizeof(char *) * (FIXED_ARGS_NUM + extra_args_num); + /* 4 fixed args, extra args, terminating NULL */ + int sz = sizeof(char *) * (4 + extra_args_num + 1); int i; argv = i_malloc(sz); |