diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-09-16 05:35:25 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-09-16 05:35:25 +0000 |
commit | c51cea076b7fa2edac4680816b7dca8c66e4fb14 (patch) | |
tree | 086f39ac1752387266bbc3ca70189ed70a544f27 /libexec/spamd-setup/spamd-setup.c | |
parent | f35ebbd70a0600b1dd147d2f6eace9d69c4000ac (diff) |
clean C for a change
Diffstat (limited to 'libexec/spamd-setup/spamd-setup.c')
-rw-r--r-- | libexec/spamd-setup/spamd-setup.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c index cece77db761..739d4d9a53a 100644 --- a/libexec/spamd-setup/spamd-setup.c +++ b/libexec/spamd-setup/spamd-setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd-setup.c,v 1.19 2004/06/29 11:19:07 mickey Exp $ */ +/* $OpenBSD: spamd-setup.c,v 1.20 2004/09/16 05:35:24 deraadt Exp $ */ /* * Copyright (c) 2003 Bob Beck. All rights reserved. @@ -74,7 +74,7 @@ u_int32_t ptoa(char *cp); int parse_netblock(char *buf, struct bl *start, struct bl *end, int white); int open_child(char *file, char **argv); -int fetch(char *url); +int fileget(char *url); int open_file(char *method, char *file); char *fix_quoted_colons(char *buf); void do_message(FILE *sdc, char *msg); @@ -178,16 +178,6 @@ atop(u_int32_t addr) return(inet_ntoa(in)); } -u_int32_t -ptoa(char *cp) -{ - struct in_addr in; - - memset(&in, 0, sizeof(in)); - (void) inet_aton(cp, &in); - return ntohl(in.s_addr); -} - int parse_netblock(char *buf, struct bl *start, struct bl *end, int white) { @@ -258,12 +248,11 @@ parse_netblock(char *buf, struct bl *start, struct bl *end, int white) int open_child(char *file, char **argv) { - pid_t pid; int pdes[2]; if (pipe(pdes) != 0) return(-1); - switch (pid = fork()) { + switch (fork()) { case -1: close(pdes[0]); close(pdes[1]); @@ -285,9 +274,16 @@ open_child(char *file, char **argv) } int -fetch(char *url) +fileget(char *url) { - char *argv[6]= {"ftp", "-V", "-o", "-", url, NULL}; + char *argv[6]; + + argv[0] = "ftp"; + argv[1] = "-V"; + argv[2] = "-o"; + argv[3] = "-"; + argv[4] = url; + argv[5] = NULL; if (debug) fprintf(stderr, "Getting %s\n", url); @@ -309,7 +305,7 @@ open_file(char *method, char *file) asprintf(&url, "%s://%s", method, file); if (url == NULL) return(-1); - i = fetch(url); + i = fileget(url); free(url); return(i); } else if (strcmp(method, "exec") == 0) { @@ -639,12 +635,11 @@ configure_pf(struct cidr **blacklists) "-f" "-", NULL}; static FILE *pf = NULL; int pdes[2]; - pid_t pid; if (pf == NULL) { if (pipe(pdes) != 0) return(-1); - switch (pid = fork()) { + switch (fork()) { case -1: close(pdes[0]); close(pdes[1]); |