From: Philip Hazel Date: Mon, 27 Jun 2005 14:29:43 +0000 (+0000) Subject: Added lots of "(void)" casts to standard function calls. X-Git-Tag: exim-4_52~21 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f1e894f37fb99398f7447220925a915bd031491a;p=exim.git Added lots of "(void)" casts to standard function calls. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 8628e8822..fe365b8d4 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.173 2005/06/27 10:52:20 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.174 2005/06/27 14:29:43 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -182,10 +182,12 @@ PH/25 Put debug statements on either side of calls to EXIM_DBOPEN() for hints db.h files). PH/26 Insert a lot of missing (void) casts for functions such as chown(), - chmod(), fcntl(), and sscanf(). These were picked up on a user's system - that detects such things. There doesn't seem to be a gcc warning option - for this - only an attribute that has to be put on the function's - prototype. I'm sure I haven't caught all of these, but it's a start. + chmod(), fcntl(), sscanf(), and other functions from stdio.h. These were + picked up on a user's system that detects such things. There doesn't seem + to be a gcc warning option for this - only an attribute that has to be + put on the function's prototype. It seems that in Fedora Core 4 they have + set this on a number of new functions. No doubt there will be more in due + course. PH/27 If a dnslookup or manualroute router is set with verify=only, it need not specify a transport. However, if an address that was verified by such a diff --git a/src/src/acl.c b/src/src/acl.c index adaea7b23..60c0fc3e0 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.40 2005/06/20 13:58:22 ph10 Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.41 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -3132,7 +3132,7 @@ if (Ustrchr(ss, ' ') == NULL) return ERROR; } acl_text[statbuf.st_size] = 0; - close(fd); + (void)close(fd); acl_name = string_sprintf("ACL \"%s\"", ss); HDEBUG(D_acl) debug_printf("read ACL from file %s\n", ss); diff --git a/src/src/auths/pwcheck.c b/src/src/auths/pwcheck.c index f477b6f06..115c1454d 100644 --- a/src/src/auths/pwcheck.c +++ b/src/src/auths/pwcheck.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/auths/pwcheck.c,v 1.1 2004/10/07 13:10:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/auths/pwcheck.c,v 1.2 2005/06/27 14:29:44 ph10 Exp $ */ /* SASL server API implementation * Rob Siemborski @@ -137,7 +137,7 @@ return PWCHECK_FAIL; start += n; } - close(s); + (void)close(s); if (start > 1 && !strncmp(response, "OK", 2)) { return PWCHECK_OK; @@ -220,14 +220,14 @@ int saslauthd_verify_password(const uschar *userid, if ( write_string(s, userid, Ustrlen(userid)) < 0) { DEBUG(D_auth) debug_printf("Failed to send userid to saslauthd daemon \n"); - close(s); + (void)close(s); return PWCHECK_FAIL; } if ( write_string(s, password, Ustrlen(password)) < 0) { DEBUG(D_auth) debug_printf("Failed to send password to saslauthd daemon \n"); - close(s); + (void)close(s); return PWCHECK_FAIL; } @@ -236,25 +236,25 @@ int saslauthd_verify_password(const uschar *userid, if ( write_string(s, service, Ustrlen(service)) < 0) { DEBUG(D_auth) debug_printf("Failed to send service name to saslauthd daemon \n"); - close(s); + (void)close(s); return PWCHECK_FAIL; } if ( write_string(s, realm, Ustrlen(realm)) < 0) { DEBUG(D_auth) debug_printf("Failed to send realm to saslauthd daemon \n"); - close(s); + (void)close(s); return PWCHECK_FAIL; } if ( read_string(s, &daemon_reply ) < 2) { DEBUG(D_auth) debug_printf("Corrupted answer '%s' received. \n", daemon_reply); - close(s); + (void)close(s); return PWCHECK_FAIL; } - close(s); + (void)close(s); DEBUG(D_auth) debug_printf("Answer '%s' received. \n", daemon_reply); diff --git a/src/src/buildconfig.c b/src/src/buildconfig.c index 2cfc32de2..e7be3eab1 100644 --- a/src/src/buildconfig.c +++ b/src/src/buildconfig.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/buildconfig.c,v 1.9 2005/06/17 13:52:15 ph10 Exp $ */ +/* $Cambridge: exim/src/src/buildconfig.c,v 1.10 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -181,7 +181,7 @@ base = fopen("Makefile", "rb"); if (base == NULL) { printf("*** Buildconfig: failed to open Makefile\n"); - fclose(new); + (void)fclose(new); exit(1); } @@ -293,7 +293,7 @@ if (strcmp(cc, "gcc") == 0 && strstr(ostype, "IRIX") != NULL) } fprintf(new, "\n"); -fclose(base); +(void)fclose(base); /* Now handle the macros listed in the defaults */ @@ -302,7 +302,7 @@ base = fopen("../src/config.h.defaults", "rb"); if (base == NULL) { printf("*** Buildconfig: failed to open ../src/config.h.defaults\n"); - fclose(new); + (void)fclose(new); exit(1); } @@ -815,7 +815,7 @@ while (fgets(buffer, sizeof(buffer), base) != NULL) } } -fclose(base); +(void)fclose(base); /* If any AUTH macros were defined, ensure that SUPPORT_CRYPTEQ is also defined. */ @@ -829,7 +829,7 @@ if (have_auth) /* End off */ fprintf(new, "\n/* End of config.h */\n"); -fclose(new); +(void)fclose(new); return 0; } diff --git a/src/src/child.c b/src/src/child.c index 17aa1e243..2cd5e6fb9 100644 --- a/src/src/child.c +++ b/src/src/child.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/child.c,v 1.4 2005/02/17 11:58:25 ph10 Exp $ */ +/* $Cambridge: exim/src/src/child.c,v 1.5 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -32,9 +32,9 @@ static void force_fd(int oldfd, int newfd) { if (oldfd == newfd) return; -close(newfd); -dup2(oldfd, newfd); -close(oldfd); +(void)close(newfd); +(void)dup2(oldfd, newfd); +(void)close(oldfd); } @@ -201,7 +201,7 @@ Exim. Failure is signalled with EX_EXECFAILED, but this shouldn't occur! */ if (pid == 0) { force_fd(pfd[pipe_read], 0); - close(pfd[pipe_write]); + (void)close(pfd[pipe_write]); if (debug_fd > 0) force_fd(debug_fd, 2); if (bounce_sender_authentication != NULL) child_exec_exim(CEE_EXEC_EXIT, FALSE, NULL, FALSE, 8, @@ -217,7 +217,7 @@ if (pid == 0) pipe. */ save_errno = errno; -close(pfd[pipe_read]); +(void)close(pfd[pipe_read]); /* Fork succeeded */ @@ -229,7 +229,7 @@ if (pid > 0) /* Fork failed */ -close(pfd[pipe_write]); +(void)close(pfd[pipe_write]); errno = save_errno; return (pid_t)(-1); } @@ -280,8 +280,8 @@ pid_t pid; if (pipe(inpfd) != 0) return (pid_t)(-1); if (pipe(outpfd) != 0) { - close(inpfd[pipe_read]); - close(inpfd[pipe_write]); + (void)close(inpfd[pipe_read]); + (void)close(inpfd[pipe_write]); return (pid_t)(-1); } @@ -301,14 +301,14 @@ if (pid == 0) { if (make_leader && setpgid(0,0) < 0) goto CHILD_FAILED; - close(inpfd[pipe_write]); + (void)close(inpfd[pipe_write]); force_fd(inpfd[pipe_read], 0); - close(outpfd[pipe_read]); + (void)close(outpfd[pipe_read]); force_fd(outpfd[pipe_write], 1); - close(2); - dup2(1, 2); + (void)close(2); + (void)dup2(1, 2); /* Set the required environment. */ @@ -338,8 +338,8 @@ if (pid == 0) stdin pipe, and the writing end of the stdout pipe. */ save_errno = errno; -close(inpfd[pipe_read]); -close(outpfd[pipe_write]); +(void)close(inpfd[pipe_read]); +(void)close(outpfd[pipe_write]); /* Fork succeeded; return the input/output pipes and the pid */ @@ -352,8 +352,8 @@ if (pid > 0) /* Fork failed; reset fork errno before returning */ -close(inpfd[pipe_write]); -close(outpfd[pipe_read]); +(void)close(inpfd[pipe_write]); +(void)close(outpfd[pipe_read]); errno = save_errno; return (pid_t)(-1); } diff --git a/src/src/daemon.c b/src/src/daemon.c index fb74d83f2..55e14776f 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/daemon.c,v 1.12 2005/06/22 15:44:37 ph10 Exp $ */ +/* $Cambridge: exim/src/src/daemon.c,v 1.13 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -419,7 +419,7 @@ if (pid == 0) extensive comment before the reception loop in exim.c for a fuller explanation of this logic. */ - for (i = 0; i < listen_socket_count; i++) close(listen_sockets[i]); + for (i = 0; i < listen_socket_count; i++) (void)close(listen_sockets[i]); #ifdef SA_NOCLDWAIT act.sa_handler = SIG_IGN; @@ -603,8 +603,8 @@ if (pid == 0) if ((dpid = fork()) == 0) { - fclose(smtp_in); - fclose(smtp_out); + (void)fclose(smtp_in); + (void)fclose(smtp_out); /* Don't ever molest the parent's SSL connection, but do clean up the data structures if necessary. */ @@ -691,7 +691,7 @@ if (smtp_out != NULL) strerror(errno)); smtp_out = NULL; } -else close(accept_socket); +else (void)close(accept_socket); if (smtp_in != NULL) { @@ -700,7 +700,7 @@ if (smtp_in != NULL) strerror(errno)); smtp_in = NULL; } -else close(dup_accept_socket); +else (void)close(dup_accept_socket); /* Release any store used in this process, including the store used for holding the incoming host address and an expanded active_hostname. */ @@ -1208,9 +1208,9 @@ if (background_daemon) { log_close_all(); /* Just in case anything was logged earlier */ search_tidyup(); /* Just in case any were used in reading the config. */ - close(0); /* Get rid of stdin/stdout/stderr */ - close(1); - close(2); + (void)close(0); /* Get rid of stdin/stdout/stderr */ + (void)close(1); + (void)close(2); exim_nullstd(); /* Connect stdin/stdout/stderr to /dev/null */ log_stderr = NULL; /* So no attempt to copy paniclog output */ @@ -1320,7 +1320,7 @@ if (daemon_listen) { DEBUG(D_any) debug_printf("wildcard IPv4 bind() failed after IPv6 " "listen() success; EADDRINUSE ignored\n"); - close(listen_sockets[sk]); + (void)close(listen_sockets[sk]); goto SKIP_SOCKET; } msg = US strerror(errno); @@ -1366,7 +1366,7 @@ if (daemon_listen) DEBUG(D_any) debug_printf("wildcard IPv4 listen() failed after IPv6 " "listen() success; EADDRINUSE ignored\n"); - close(listen_sockets[sk]); + (void)close(listen_sockets[sk]); /* Come here if there has been a problem with the socket which we are going to ignore. We remove the address from the chain, and back up the @@ -1613,7 +1613,8 @@ for (;;) /* Close any open listening sockets in the child */ - for (sk = 0; sk < listen_socket_count; sk++) close(listen_sockets[sk]); + for (sk = 0; sk < listen_socket_count; sk++) + (void)close(listen_sockets[sk]); /* Reset SIGHUP and SIGCHLD in the child in both cases. */ @@ -1857,7 +1858,8 @@ for (;;) int sk; log_write(0, LOG_MAIN, "pid %d: SIGHUP received: re-exec daemon", getpid()); - for (sk = 0; sk < listen_socket_count; sk++) close(listen_sockets[sk]); + for (sk = 0; sk < listen_socket_count; sk++) + (void)close(listen_sockets[sk]); alarm(0); signal(SIGHUP, SIG_IGN); sighup_argv[0] = exim_path; diff --git a/src/src/dbfn.c b/src/src/dbfn.c index 53f2212ac..d46ad247a 100644 --- a/src/src/dbfn.c +++ b/src/src/dbfn.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/dbfn.c,v 1.5 2005/06/22 15:44:37 ph10 Exp $ */ +/* $Cambridge: exim/src/src/dbfn.c,v 1.6 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -141,7 +141,7 @@ if (rc < 0) log_write(0, LOG_MAIN, "Failed to get %s lock for %s: %s", ((flags & O_RDONLY) != 0)? "read" : "write", buffer, (errno == ETIMEDOUT)? "timed out" : strerror(errno)); - close(dbblock->lockfd); + (void)close(dbblock->lockfd); errno = 0; /* Indicates locking failure */ return NULL; } @@ -229,7 +229,7 @@ if (dbblock->dbptr == NULL) debug_printf("%s", CS string_open_failed(save_errno, "DB file %s\n", buffer)); } - close(dbblock->lockfd); + (void)close(dbblock->lockfd); errno = save_errno; return NULL; } @@ -261,7 +261,7 @@ void dbfn_close(open_db *dbblock) { EXIM_DBCLOSE(dbblock->dbptr); -close(dbblock->lockfd); +(void)close(dbblock->lockfd); } diff --git a/src/src/deliver.c b/src/src/deliver.c index a026ec65a..41a43c80d 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/deliver.c,v 1.19 2005/06/22 15:44:37 ph10 Exp $ */ +/* $Cambridge: exim/src/src/deliver.c,v 1.20 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -798,7 +798,7 @@ if (addr->return_file >= 0 && addr->return_filename != NULL) log_write(0, LOG_MAIN, "<%s>: %s transport output: %s", addr->address, tb->name, s); } - fclose(f); + (void)fclose(f); } } @@ -829,7 +829,7 @@ if (addr->return_file >= 0 && addr->return_filename != NULL) addr->return_file = -1; } - close(addr->return_file); + (void)close(addr->return_file); } /* Create the address string for logging. Must not do this earlier, because @@ -1728,7 +1728,7 @@ if ((pid = fork()) == 0) half - for transports that exec things (e.g. pipe). Then set the required gid/uid. */ - close(pfd[pipe_read]); + (void)close(pfd[pipe_read]); (void)fcntl(pfd[pipe_write], F_SETFD, fcntl(pfd[pipe_write], F_GETFD) | FD_CLOEXEC); exim_setugid(uid, gid, use_initgroups, @@ -1794,13 +1794,13 @@ if ((pid = fork()) == 0) int local_part_length = Ustrlen(addr2->local_part); uschar *s; - write(pfd[pipe_write], (void *)&(addr2->transport_return), sizeof(int)); - write(pfd[pipe_write], (void *)&transport_count, sizeof(transport_count)); - write(pfd[pipe_write], (void *)&(addr2->flags), sizeof(addr2->flags)); - write(pfd[pipe_write], (void *)&(addr2->basic_errno), sizeof(int)); - write(pfd[pipe_write], (void *)&(addr2->more_errno), sizeof(int)); - write(pfd[pipe_write], (void *)&(addr2->special_action), sizeof(int)); - write(pfd[pipe_write], (void *)&(addr2->transport), + (void)write(pfd[pipe_write], (void *)&(addr2->transport_return), sizeof(int)); + (void)write(pfd[pipe_write], (void *)&transport_count, sizeof(transport_count)); + (void)write(pfd[pipe_write], (void *)&(addr2->flags), sizeof(addr2->flags)); + (void)write(pfd[pipe_write], (void *)&(addr2->basic_errno), sizeof(int)); + (void)write(pfd[pipe_write], (void *)&(addr2->more_errno), sizeof(int)); + (void)write(pfd[pipe_write], (void *)&(addr2->special_action), sizeof(int)); + (void)write(pfd[pipe_write], (void *)&(addr2->transport), sizeof(transport_instance *)); /* For a file delivery, pass back the local part, in case the original @@ -1809,8 +1809,8 @@ if ((pid = fork()) == 0) if (testflag(addr2, af_file)) { - write(pfd[pipe_write], (void *)&local_part_length, sizeof(int)); - write(pfd[pipe_write], addr2->local_part, local_part_length); + (void)write(pfd[pipe_write], (void *)&local_part_length, sizeof(int)); + (void)write(pfd[pipe_write], addr2->local_part, local_part_length); } /* Now any messages */ @@ -1818,15 +1818,15 @@ if ((pid = fork()) == 0) for (i = 0, s = addr2->message; i < 2; i++, s = addr2->user_message) { int message_length = (s == NULL)? 0 : Ustrlen(s) + 1; - write(pfd[pipe_write], (void *)&message_length, sizeof(int)); - if (message_length > 0) write(pfd[pipe_write], s, message_length); + (void)write(pfd[pipe_write], (void *)&message_length, sizeof(int)); + if (message_length > 0) (void)write(pfd[pipe_write], s, message_length); } } /* OK, this process is now done. Free any cached resources that it opened, and close the pipe we were writing down before exiting. */ - close(pfd[pipe_write]); + (void)close(pfd[pipe_write]); search_tidyup(); exit(EXIT_SUCCESS); } @@ -1845,7 +1845,7 @@ on an empty pipe. We check that a status exists for each address before overwriting the address structure. If data is missing, the default DEFER status will remain. Afterwards, close the reading end. */ -close(pfd[pipe_write]); +(void)close(pfd[pipe_write]); for (addr2 = addr; addr2 != NULL; addr2 = addr2->next) { @@ -1895,7 +1895,7 @@ for (addr2 = addr; addr2 != NULL; addr2 = addr2->next) } } -close(pfd[pipe_read]); +(void)close(pfd[pipe_read]); /* Unless shadowing, write all successful addresses immediately to the journal file, to ensure they are recorded asap. For homonymic addresses, use the base @@ -1998,7 +1998,7 @@ if (addr->special_action == SPECIAL_WARN && /* Close and wait for child process to complete, without a timeout. */ - fclose(f); + (void)fclose(f); (void)child_close(pid, 0); } } @@ -2885,7 +2885,7 @@ if (!eop && !done) /* Close our end of the pipe, to prevent deadlock if the far end is still pushing stuff into it. */ -close(fd); +(void)close(fd); p->fd = -1; /* If we have finished without error, but haven't had data for every address, @@ -3707,8 +3707,8 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) if (poffset >= remote_max_parallel) { - close(pfd[pipe_write]); - close(pfd[pipe_read]); + (void)close(pfd[pipe_write]); + (void)close(pfd[pipe_read]); remote_post_process(addr, LOG_MAIN|LOG_PANIC, US"Unexpectedly no free subprocess slot", fallback); continue; @@ -3754,7 +3754,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) that are running in parallel. */ for (poffset = 0; poffset < remote_max_parallel; poffset++) - if (parlist[poffset].pid != 0) close(parlist[poffset].fd); + if (parlist[poffset].pid != 0) (void)close(parlist[poffset].fd); /* This process has inherited a copy of the file descriptor for the data file, but its file pointer is shared with all the @@ -3764,7 +3764,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) the parent process. There doesn't seem to be any way of doing a dup-with-new-file-pointer. */ - close(deliver_datafile); + (void)close(deliver_datafile); sprintf(CS spoolname, "%s/input/%s/%s-D", spool_directory, message_subdir, message_id); deliver_datafile = Uopen(spoolname, O_RDWR | O_APPEND, 0); @@ -3788,7 +3788,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) and run the transport. Afterwards, transport_count will contain the number of bytes written. */ - close(pfd[pipe_read]); + (void)close(pfd[pipe_read]); set_process_info("delivering %s using %s", message_id, tp->name); debug_print_string(tp->debug_string); if (!(tp->info->code)(addr->transport, addr)) replicate_status(addr); @@ -3817,7 +3817,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) { if (h->address == NULL || h->status < hstatus_unusable) continue; sprintf(CS big_buffer, "H%c%c%s", h->status, h->why, h->address); - write(fd, big_buffer, Ustrlen(big_buffer+3) + 4); + (void)write(fd, big_buffer, Ustrlen(big_buffer+3) + 4); } /* The number of bytes written. This is the same for each address. Even @@ -3827,7 +3827,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) big_buffer[0] = 'S'; memcpy(big_buffer+1, &transport_count, sizeof(transport_count)); - write(fd, big_buffer, sizeof(transport_count) + 1); + (void)write(fd, big_buffer, sizeof(transport_count) + 1); /* Information about what happened to each address. Three item types are used: an optional 'X' item first, for TLS information, followed by 'R' @@ -3857,7 +3857,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) sprintf(CS ptr, "%.512s", addr->peerdn); while(*ptr++); } - write(fd, big_buffer, ptr - big_buffer); + (void)write(fd, big_buffer, ptr - big_buffer); } #endif @@ -3877,7 +3877,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) sprintf(CS ptr, "%.512s", r->message); while(*ptr++); } - write(fd, big_buffer, ptr - big_buffer); + (void)write(fd, big_buffer, ptr - big_buffer); } /* The rest of the information goes in an 'A' item. */ @@ -3913,7 +3913,7 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) memcpy(ptr, &(addr->host_used->port), sizeof(addr->host_used->port)); ptr += sizeof(addr->host_used->port); } - write(fd, big_buffer, ptr - big_buffer); + (void)write(fd, big_buffer, ptr - big_buffer); } /* Add termination flag, close the pipe, and that's it. The character @@ -3923,20 +3923,20 @@ for (delivery_count = 0; addr_remote != NULL; delivery_count++) big_buffer[0] = 'Z'; big_buffer[1] = (continue_transport == NULL)? '0' : '1'; - write(fd, big_buffer, 2); - close(fd); + (void)write(fd, big_buffer, 2); + (void)close(fd); exit(EXIT_SUCCESS); } /* Back in the mainline: close the unwanted half of the pipe. */ - close(pfd[pipe_write]); + (void)close(pfd[pipe_write]); /* Fork failed; defer with error message */ if (pid < 0) { - close(pfd[pipe_read]); + (void)close(pfd[pipe_read]); remote_post_process(addr, LOG_MAIN|LOG_PANIC, string_sprintf("fork failed for remote delivery to %s: %s", addr->domain, strerror(errno)), fallback); @@ -4517,7 +4517,7 @@ if ((rc = spool_read_header(spoolname, TRUE, TRUE)) != spool_read_OK) readconf_printtime(keep_malformed)); } - close(deliver_datafile); + (void)close(deliver_datafile); deliver_datafile = -1; return continue_closedown(); /* yields DELIVER_NOT_ATTEMPTED */ } @@ -4543,7 +4543,7 @@ if (jread != NULL) DEBUG(D_deliver) debug_printf("Previously delivered address %s taken from " "journal file\n", big_buffer); } - fclose(jread); + (void)fclose(jread); /* Panic-dies on error */ (void)spool_write_header(message_id, SW_DELIVERING, NULL); } @@ -4558,7 +4558,7 @@ else if (errno != ENOENT) if (recipients_list == NULL) { - close(deliver_datafile); + (void)close(deliver_datafile); deliver_datafile = -1; log_write(0, LOG_MAIN, "Spool error: no recipients for %s", spoolname); return continue_closedown(); /* yields DELIVER_NOT_ATTEMPTED */ @@ -4618,7 +4618,7 @@ if (deliver_freeze) continue_hostname != NULL )) { - close(deliver_datafile); + (void)close(deliver_datafile); deliver_datafile = -1; log_write(L_skip_delivery, LOG_MAIN, "Message is frozen"); return continue_closedown(); /* yields DELIVER_NOT_ATTEMPTED */ @@ -4753,7 +4753,7 @@ else if (system_filter != NULL && process_recipients != RECIP_FAIL_TIMEOUT) if (rc == FF_ERROR || rc == FF_NONEXIST) { - close(deliver_datafile); + (void)close(deliver_datafile); deliver_datafile = -1; log_write(0, LOG_MAIN|LOG_PANIC, "Error in system filter: %s", string_printing(filter_message)); @@ -6292,7 +6292,7 @@ wording. */ else { while ((ch = fgetc(fm)) != EOF) fputc(ch, f); - fclose(fm); + (void)fclose(fm); } Uunlink(addr->return_filename); @@ -6365,13 +6365,13 @@ wording. */ { emf_text = next_emf(emf, US"final"); if (emf_text != NULL) fprintf(f, "%s", CS emf_text); - fclose(emf); + (void)fclose(emf); } /* Close the file, which should send an EOF to the child process that is receiving the message. Wait for it to finish. */ - fclose(f); + (void)fclose(f); rc = child_close(pid, 0); /* Waits for child to close, no timeout */ /* In the test harness, let the child do it's thing first. */ @@ -6738,7 +6738,7 @@ else if (addr_defer != (address_item *)(+1)) { wmf_text = next_emf(wmf, US"final"); if (wmf_text != NULL) fprintf(f, "%s", CS wmf_text); - fclose(wmf); + (void)fclose(wmf); } else { @@ -6752,7 +6752,7 @@ else if (addr_defer != (address_item *)(+1)) /* Close and wait for child process to complete, without a timeout. If there's an error, don't update the count. */ - fclose(f); + (void)fclose(f); if (child_close(pid, 0) == 0) { warning_count = count; @@ -6835,7 +6835,7 @@ else if (addr_defer != (address_item *)(+1)) /* Finished with the message log. If the message is complete, it will have been unlinked or renamed above. */ -if (message_logs) fclose(message_log); +if (message_logs) (void)fclose(message_log); /* Now we can close and remove the journal file. Its only purpose is to record successfully completed deliveries asap so that this information doesn't get @@ -6849,7 +6849,7 @@ the remove_journal flag. When the journal is left, we also don't move the message off the main spool if frozen and the option is set. It should get moved at the next attempt, after the journal has been inspected. */ -if (journal_fd >= 0) close(journal_fd); +if (journal_fd >= 0) (void)close(journal_fd); if (remove_journal) { @@ -6870,7 +6870,7 @@ if (remove_journal) will go away. Otherwise the message becomes available for another process to try delivery. */ -close(deliver_datafile); +(void)close(deliver_datafile); deliver_datafile = -1; DEBUG(D_deliver) debug_printf("end delivery of %s\n", id); diff --git a/src/src/demime.c b/src/src/demime.c index 66c9f17b3..70125a53d 100644 --- a/src/src/demime.c +++ b/src/src/demime.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/demime.c,v 1.5 2005/05/24 08:15:02 tom Exp $ */ +/* $Cambridge: exim/src/src/demime.c,v 1.6 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -60,7 +60,7 @@ int demime(uschar **listptr) { if (!demime_ok) demime_rc = mime_demux(mbox_file, defer_error_buffer); - fclose(mbox_file); + (void)fclose(mbox_file); if (demime_rc == DEFER) { /* temporary failure (DEFER => DEFER) */ @@ -346,7 +346,7 @@ int mime_read_line(FILE *f, int mime_demux_mode, uschar *buffer, long *num_copie c = fgetc(f); if (c == EOF) break; if ( (c == '\t') || (c == ' ') ) continue; - ungetc(c,f); + (void)ungetc(c,f); }; /* end of the header, terminate with ';' */ c = ';'; @@ -1078,14 +1078,14 @@ int mime_demux(FILE *f, uschar *info) { if (data_len == -2) { /* temp error, turn off uudecode mode */ if (uu_dump_file != NULL) { - fclose(uu_dump_file); uu_dump_file = NULL; + (void)fclose(uu_dump_file); uu_dump_file = NULL; }; uu_mode = MIME_UU_MODE_OFF; return DEFER; } else if (data_len == -1) { if (uu_dump_file != NULL) { - fclose(uu_dump_file); uu_dump_file = NULL; + (void)fclose(uu_dump_file); uu_dump_file = NULL; }; uu_mode = MIME_UU_MODE_OFF; data_len = 0; @@ -1101,7 +1101,7 @@ int mime_demux(FILE *f, uschar *info) { check for single "end" tag on line */ if ((strncmpic(line,US"end",3) == 0) && (line[3] < 32)) { if (uu_dump_file != NULL) { - fclose(uu_dump_file); uu_dump_file = NULL; + (void)fclose(uu_dump_file); uu_dump_file = NULL; }; uu_mode = MIME_UU_MODE_OFF; } @@ -1110,7 +1110,7 @@ int mime_demux(FILE *f, uschar *info) { if (data_len == -2) { /* temp error, turn off uudecode mode */ if (uu_dump_file != NULL) { - fclose(uu_dump_file); uu_dump_file = NULL; + (void)fclose(uu_dump_file); uu_dump_file = NULL; }; uu_mode = MIME_UU_MODE_OFF; return DEFER; @@ -1152,7 +1152,7 @@ int mime_demux(FILE *f, uschar *info) { mime_demux(mime_dump_file,info); }; - fclose(mime_dump_file); mime_dump_file = NULL; + (void)fclose(mime_dump_file); mime_dump_file = NULL; }; } else if (tmp == 2) { @@ -1167,7 +1167,7 @@ int mime_demux(FILE *f, uschar *info) { mime_demux(mime_dump_file,info); }; - fclose(mime_dump_file); mime_dump_file = NULL; + (void)fclose(mime_dump_file); mime_dump_file = NULL; }; } else { @@ -1218,9 +1218,9 @@ int mime_demux(FILE *f, uschar *info) { /* close files, they could still be open */ if (mime_dump_file != NULL) - fclose(mime_dump_file); + (void)fclose(mime_dump_file); if (uu_dump_file != NULL) - fclose(uu_dump_file); + (void)fclose(uu_dump_file); /* release line buffer */ free(line); diff --git a/src/src/dk.c b/src/src/dk.c index 30dfc78be..4dbd37861 100644 --- a/src/src/dk.c +++ b/src/src/dk.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/dk.c,v 1.4 2005/06/24 08:23:21 tom Exp $ */ +/* $Cambridge: exim/src/src/dk.c,v 1.5 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -384,8 +384,8 @@ uschar *dk_exim_sign(int dk_fd, /* Looks like a filename, load the private key. */ memset(big_buffer,0,big_buffer_size); privkey_fd = open(CS dk_private_key,O_RDONLY); - read(privkey_fd,big_buffer,16383); - close(privkey_fd); + (void)read(privkey_fd,big_buffer,16383); + (void)close(privkey_fd); dk_private_key = big_buffer; } diff --git a/src/src/exim_dbmbuild.c b/src/src/exim_dbmbuild.c index 2d4bc3b6a..d9f3bfc6a 100644 --- a/src/src/exim_dbmbuild.c +++ b/src/src/exim_dbmbuild.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim_dbmbuild.c,v 1.3 2005/06/14 10:32:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim_dbmbuild.c,v 1.4 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -207,7 +207,7 @@ if (d == NULL) { printf("exim_dbmbuild: unable to create %s: %s\n", temp_dbmname, strerror(errno)); - fclose(f); + (void)fclose(f); exit(1); } @@ -404,7 +404,7 @@ if (started) TIDYUP: EXIM_DBCLOSE(d); -fclose(f); +(void)fclose(f); /* If successful, output the number of entries and rename the temporary files. */ diff --git a/src/src/exim_dbutil.c b/src/src/exim_dbutil.c index 5e00eaea8..a30c695b7 100644 --- a/src/src/exim_dbutil.c +++ b/src/src/exim_dbutil.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim_dbutil.c,v 1.6 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim_dbutil.c,v 1.7 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -316,7 +316,7 @@ if (rc < 0) printf("** Failed to get %s lock for %s: %s", ((flags & O_RDONLY) != 0)? "read" : "write", buffer, (errno == ETIMEDOUT)? "timed out" : strerror(errno)); - close(dbblock->lockfd); + (void)close(dbblock->lockfd); return NULL; } @@ -336,7 +336,7 @@ if (dbblock->dbptr == NULL) "" #endif ); - close(dbblock->lockfd); + (void)close(dbblock->lockfd); return NULL; } @@ -361,7 +361,7 @@ static void dbfn_close(open_db *dbblock) { EXIM_DBCLOSE(dbblock->dbptr); -close(dbblock->lockfd); +(void)close(dbblock->lockfd); } diff --git a/src/src/exim_lock.c b/src/src/exim_lock.c index 9b5b26209..9e2f43373 100644 --- a/src/src/exim_lock.c +++ b/src/src/exim_lock.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim_lock.c,v 1.2 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim_lock.c,v 1.3 2005/06/27 14:29:43 ph10 Exp $ */ /* A program to lock a file exactly as Exim would, for investigation of interlocking problems. @@ -329,7 +329,7 @@ for (j = 0; j < lock_retries; j++) /* Apply hitching post algorithm. */ if ((rc = link(hitchname, lockname)) != 0) fstat(hd, &statbuf); - close(hd); + (void)close(hd); unlink(hitchname); if (rc != 0 && statbuf.st_nlink != 2) diff --git a/src/src/expand.c b/src/src/expand.c index ca340bb1b..632b1d933 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/expand.c,v 1.35 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/expand.c,v 1.36 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -3511,7 +3511,7 @@ while (*s != 0) } yield = cat_file(f, yield, &size, &ptr, sub_arg[1]); - fclose(f); + (void)fclose(f); continue; } @@ -3604,7 +3604,7 @@ while (*s != 0) alarm(timeout); yield = cat_file(f, yield, &size, &ptr, sub_arg[3]); alarm(0); - fclose(f); + (void)fclose(f); /* After a timeout, we restore the pointer in the result, that is, make sure we add nothing from the socket. */ @@ -3701,7 +3701,7 @@ while (*s != 0) /* Nothing is written to the standard input. */ - close(fd_in); + (void)close(fd_in); /* Wait for the process to finish, applying the timeout, and inspect its return code for serious disasters. Simple non-zero returns are passed on. @@ -3732,7 +3732,7 @@ while (*s != 0) f = fdopen(fd_out, "rb"); lookup_value = NULL; lookup_value = cat_file(f, lookup_value, &lsize, &lptr, NULL); - fclose(f); + (void)fclose(f); } /* Process the yes/no strings; $value may be useful in both cases */ diff --git a/src/src/filter.c b/src/src/filter.c index 3c95af800..18c25240b 100644 --- a/src/src/filter.c +++ b/src/src/filter.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/filter.c,v 1.3 2005/01/04 10:00:42 ph10 Exp $ */ +/* $Cambridge: exim/src/src/filter.c,v 1.4 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1907,7 +1907,7 @@ while (commands != NULL) if (log_mode == -1) log_mode = 0600; if (log_fd >= 0) { - close(log_fd); + (void)close(log_fd); log_fd = -1; } log_filename = expargs[0]; @@ -2500,7 +2500,7 @@ if (filter_test != FTEST_NONE || (debug_selector & D_filter) != 0) /* Close the log file if it was opened, and kill off any numerical variables before returning. Reset the header decoding charset. */ -if (log_fd >= 0) close(log_fd); +if (log_fd >= 0) (void)close(log_fd); expand_nmax = -1; filter_running = FALSE; headers_charset = save_headers_charset; diff --git a/src/src/filtertest.c b/src/src/filtertest.c index 107e35e0b..934085ec9 100644 --- a/src/src/filtertest.c +++ b/src/src/filtertest.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/filtertest.c,v 1.5 2005/04/06 14:40:24 ph10 Exp $ */ +/* $Cambridge: exim/src/src/filtertest.c,v 1.6 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -181,7 +181,7 @@ if (fstat(fd, &statbuf) != 0) filebuf = store_get(statbuf.st_size + 1); rc = read(fd, filebuf, statbuf.st_size); -close(fd); +(void)close(fd); if (rc != statbuf.st_size) { diff --git a/src/src/ip.c b/src/src/ip.c index 72bcd9e07..63645f139 100644 --- a/src/src/ip.c +++ b/src/src/ip.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/ip.c,v 1.2 2005/01/04 10:00:42 ph10 Exp $ */ +/* $Cambridge: exim/src/src/ip.c,v 1.3 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -249,7 +249,7 @@ if (rc >= 0) return 0; /* A failure whose error code is "Interrupted system call" is in fact an externally applied timeout if the signal handler has been run. */ -close(sock); +(void)close(sock); errno = (save_errno == EINTR && sigalrm_seen)? ETIMEDOUT : save_errno; return -1; } diff --git a/src/src/log.c b/src/src/log.c index a39e2abfa..a014befb7 100644 --- a/src/src/log.c +++ b/src/src/log.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/log.c,v 1.4 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/log.c,v 1.5 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -814,7 +814,7 @@ if ((flags & LOG_MAIN) != 0 && uschar *nowstamp = tod_stamp(tod_log_datestamp); if (Ustrncmp (mainlog_datestamp, nowstamp, Ustrlen(nowstamp)) != 0) { - close(mainlogfd); /* Close the file */ + (void)close(mainlogfd); /* Close the file */ mainlogfd = -1; /* Clear the file descriptor */ mainlog_inode = 0; /* Unset the inode */ mainlog_datestamp = NULL; /* Clear the datestamp */ @@ -830,7 +830,7 @@ if ((flags & LOG_MAIN) != 0 && { if (Ustat(mainlog_name, &statbuf) < 0 || statbuf.st_ino != mainlog_inode) { - close(mainlogfd); + (void)close(mainlogfd); mainlogfd = -1; mainlog_inode = 0; } @@ -936,7 +936,7 @@ if (write_rejectlog && (flags & LOG_REJECT) != 0) uschar *nowstamp = tod_stamp(tod_log_datestamp); if (Ustrncmp (rejectlog_datestamp, nowstamp, Ustrlen(nowstamp)) != 0) { - close(rejectlogfd); /* Close the file */ + (void)close(rejectlogfd); /* Close the file */ rejectlogfd = -1; /* Clear the file descriptor */ rejectlog_inode = 0; /* Unset the inode */ rejectlog_datestamp = NULL; /* Clear the datestamp */ @@ -953,7 +953,7 @@ if (write_rejectlog && (flags & LOG_REJECT) != 0) if (Ustat(rejectlog_name, &statbuf) < 0 || statbuf.st_ino != rejectlog_inode) { - close(rejectlogfd); + (void)close(rejectlogfd); rejectlogfd = -1; rejectlog_inode = 0; } @@ -1031,7 +1031,7 @@ if ((flags & LOG_PANIC) != 0) flags |= LOG_PANIC_DIE; } - close(paniclogfd); + (void)close(paniclogfd); } /* Give up if the DIE flag is set */ @@ -1051,9 +1051,9 @@ void log_close_all(void) { if (mainlogfd >= 0) - { close(mainlogfd); mainlogfd = -1; } + { (void)close(mainlogfd); mainlogfd = -1; } if (rejectlogfd >= 0) - { close(rejectlogfd); rejectlogfd = -1; } + { (void)close(rejectlogfd); rejectlogfd = -1; } closelog(); syslog_open = FALSE; } diff --git a/src/src/lookups/cdb.c b/src/src/lookups/cdb.c index e6b1541cc..68000c6b4 100644 --- a/src/src/lookups/cdb.c +++ b/src/src/lookups/cdb.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/cdb.c,v 1.2 2005/06/07 15:20:56 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/cdb.c,v 1.3 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -431,7 +431,7 @@ struct cdb_state * cdbp = handle; } #endif /* HAVE_MMAP */ - close(cdbp->fileno); + (void)close(cdbp->fileno); } /* End of lookups/cdb.c */ diff --git a/src/src/lookups/dbmdb.c b/src/src/lookups/dbmdb.c index 35480304d..2523db022 100644 --- a/src/src/lookups/dbmdb.c +++ b/src/src/lookups/dbmdb.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/dbmdb.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/dbmdb.c,v 1.3 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -58,17 +58,17 @@ rc = lf_check_file(-1, filename, S_IFREG, modemask, owners, owngroups, #else { uschar filebuffer[256]; - sprintf(CS filebuffer, "%.250s.db", filename); + (void)sprintf(CS filebuffer, "%.250s.db", filename); rc = lf_check_file(-1, filebuffer, S_IFREG, modemask, owners, owngroups, "dbm", errmsg); if (rc < 0) /* stat() failed */ { - sprintf(CS filebuffer, "%.250s.dir", filename); + (void)sprintf(CS filebuffer, "%.250s.dir", filename); rc = lf_check_file(-1, filebuffer, S_IFREG, modemask, owners, owngroups, "dbm", errmsg); if (rc == 0) /* x.dir was OK */ { - sprintf(CS filebuffer, "%.250s.pag", filename); + (void)sprintf(CS filebuffer, "%.250s.pag", filename); rc = lf_check_file(-1, filebuffer, S_IFREG, modemask, owners, owngroups, "dbm", errmsg); } diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c index f91ddf89c..c5e75dfdd 100644 --- a/src/src/lookups/lsearch.c +++ b/src/src/lookups/lsearch.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/lsearch.c,v 1.3 2005/01/11 15:51:03 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/lsearch.c,v 1.4 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -395,7 +395,7 @@ else void lsearch_close(void *handle) { -fclose((FILE *)handle); +(void)fclose((FILE *)handle); } /* End of lookups/lsearch.c */ diff --git a/src/src/malware.c b/src/src/malware.c index 53dcb3aec..c137d570f 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/malware.c,v 1.9 2005/06/06 18:49:35 tom Exp $ */ +/* $Cambridge: exim/src/src/malware.c,v 1.10 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -69,7 +69,7 @@ int malware(uschar **listptr) { }; /* none of our current scanners need the mbox file as a stream, so we can close it right away */ - fclose(mbox_file); + (void)fclose(mbox_file); /* extract the malware regex to match against from the option list */ if ((malware_regex = string_nextinlist(&list, &sep, @@ -189,7 +189,7 @@ int malware(uschar **listptr) { } if (ip_connect(sock, AF_INET, (uschar*)inet_ntoa(in), port, 5) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: connection to %s, port %u failed (%s)", inet_ntoa(in), port, strerror(errno)); @@ -205,7 +205,7 @@ int malware(uschar **listptr) { /* calc file size */ drweb_fd = open(CS scanrequest, O_RDONLY); if (drweb_fd == -1) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: can't open spool file %s: %s", scanrequest, strerror(errno)); @@ -213,8 +213,8 @@ int malware(uschar **listptr) { } fsize = lseek(drweb_fd, 0, SEEK_END); if (fsize == -1) { - close(sock); - close(drweb_fd); + (void)close(sock); + (void)close(drweb_fd); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: can't seek spool file %s: %s", scanrequest, strerror(errno)); @@ -228,8 +228,8 @@ int malware(uschar **listptr) { (send(sock, &drweb_flags, sizeof(drweb_flags), 0) < 0) || (send(sock, &drweb_fin, sizeof(drweb_fin), 0) < 0) || (send(sock, &drweb_slen, sizeof(drweb_slen), 0) < 0)) { - close(sock); - close(drweb_fd); + (void)close(sock); + (void)close(drweb_fd); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: unable to send commands to socket (%s)", drweb_options); return DEFER; @@ -237,8 +237,8 @@ int malware(uschar **listptr) { drweb_fbuf = (uschar *) malloc (fsize); if (!drweb_fbuf) { - close(sock); - close(drweb_fd); + (void)close(sock); + (void)close(drweb_fd); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: unable to allocate memory %u for file (%s)", fsize, scanrequest); @@ -247,25 +247,25 @@ int malware(uschar **listptr) { result = read (drweb_fd, drweb_fbuf, fsize); if (result == -1) { - close(sock); - close(drweb_fd); + (void)close(sock); + (void)close(drweb_fd); free(drweb_fbuf); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: can't read spool file %s: %s", scanrequest, strerror(errno)); return DEFER; } - close(drweb_fd); + (void)close(drweb_fd); /* send file body to socket */ if (send(sock, drweb_fbuf, fsize, 0) < 0) { - close(sock); + (void)close(sock); free(drweb_fbuf); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: unable to send file body to socket (%s)", drweb_options); return DEFER; } - close(drweb_fd); + (void)close(drweb_fd); } else { /* open the drwebd UNIX socket */ @@ -278,7 +278,7 @@ int malware(uschar **listptr) { server.sun_family = AF_UNIX; Ustrcpy(server.sun_path, drweb_options); if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: unable to connect to socket (%s). errno=%d", drweb_options, errno); return DEFER; @@ -296,7 +296,7 @@ int malware(uschar **listptr) { (send(sock, &drweb_slen, sizeof(drweb_slen), 0) < 0) || (send(sock, scanrequest, Ustrlen(scanrequest), 0) < 0) || (send(sock, &drweb_fin, sizeof(drweb_fin), 0) < 0)) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: unable to send commands to socket (%s)", drweb_options); return DEFER; @@ -305,7 +305,7 @@ int malware(uschar **listptr) { /* wait for result */ if ((bread = recv(sock, &drweb_rc, sizeof(drweb_rc), 0) != sizeof(drweb_rc))) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: unable to read return code"); return DEFER; @@ -313,7 +313,7 @@ int malware(uschar **listptr) { drweb_rc = ntohl(drweb_rc); if ((bread = recv(sock, &drweb_vnum, sizeof(drweb_vnum), 0) != sizeof(drweb_vnum))) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: unable to read the number of viruses"); return DEFER; @@ -336,7 +336,7 @@ int malware(uschar **listptr) { { /* read the size of report */ if ((bread = recv(sock, &drweb_slen, sizeof(drweb_slen), 0) != sizeof(drweb_slen))) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: cannot read report size"); return DEFER; @@ -345,7 +345,7 @@ int malware(uschar **listptr) { /* read report body */ if ((bread = recv(sock, tmpbuf, drweb_slen, 0)) != drweb_slen) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: cannot read report string"); return DEFER; @@ -393,13 +393,13 @@ int malware(uschar **listptr) { if (drweb_s) { log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: drweb: drweb daemon retcode 0x%x (%s)", drweb_rc, drweb_s); - close(sock); + (void)close(sock); return DEFER; } /* no virus found */ malware_name = NULL; }; - close(sock); + (void)close(sock); } /* ----------------------------------------------------------------------- */ else if (strcmpic(scanner_name,US"aveserver") == 0) { @@ -428,7 +428,7 @@ int malware(uschar **listptr) { server.sun_family = AF_UNIX; Ustrcpy(server.sun_path, kav_options); if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to connect to aveserver UNIX socket (%s). errno=%d", kav_options, errno); return DEFER; @@ -439,7 +439,7 @@ int malware(uschar **listptr) { if (buf[0] != '2') { /* aveserver is having problems */ - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: aveserver is unavailable (Responded: %s).", ((buf[0] != 0) ? buf : (uschar *)"nothing") ); return DEFER; @@ -450,7 +450,7 @@ int malware(uschar **listptr) { /* and send it */ if (send(sock, buf, Ustrlen(buf), 0) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to write to aveserver UNIX socket (%s)", kav_options); return DEFER; @@ -483,7 +483,7 @@ int malware(uschar **listptr) { /* and send it */ if (send(sock, buf, Ustrlen(buf), 0) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to write to aveserver UNIX socket (%s)", kav_options); return DEFER; @@ -494,13 +494,13 @@ int malware(uschar **listptr) { if (buf[0] != '2') { /* aveserver is having problems */ - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to quit aveserver dialogue (Responded: %s).", ((buf[0] != 0) ? buf : (uschar *)"nothing") ); return DEFER; }; - close(sock); + (void)close(sock); if (result == DEFER) return DEFER; } @@ -538,7 +538,7 @@ int malware(uschar **listptr) { server.sun_family = AF_UNIX; Ustrcpy(server.sun_path, fsecure_options); if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to connect to fsecure socket %s (%s)", fsecure_options, strerror(errno)); @@ -550,7 +550,7 @@ int malware(uschar **listptr) { for (i=0; i != 4; i++) { /* debug_printf("send option \"%s\"",cmdoptions[i]); */ if (write(sock, cmdoptions[i], Ustrlen(cmdoptions[i])) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to write fsecure option %d to %s (%s)", i, fsecure_options, strerror(errno)); @@ -560,7 +560,7 @@ int malware(uschar **listptr) { bread = read(sock, av_buffer, sizeof(av_buffer)); if (bread >0) av_buffer[bread]='\0'; if (bread < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to read fsecure answer %d (%s)", i, strerror(errno)); return DEFER; @@ -574,7 +574,7 @@ int malware(uschar **listptr) { snprintf(CS file_name,1024,"SCAN\t%s/scan/%s/%s.eml\n", spool_directory, message_id, message_id); /* debug_printf("send scan %s",file_name); */ if (write(sock, file_name, Ustrlen(file_name)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to write fsecure scan to %s (%s)", fsecure_options, strerror(errno)); @@ -593,7 +593,7 @@ int malware(uschar **listptr) { do { bread=read(sock, &av_buffer[i], 1); if (bread < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to read fsecure result (%s)", strerror(errno)); return DEFER; @@ -616,7 +616,7 @@ int malware(uschar **listptr) { }; } while (Ustrstr(av_buffer, "OK\tScan ok.") == NULL); - close(sock); + (void)close(sock); } /* ----------------------------------------------------------------------- */ @@ -652,7 +652,7 @@ int malware(uschar **listptr) { server.sun_family = AF_UNIX; Ustrcpy(server.sun_path, kav_options); if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to connect to kavdaemon UNIX socket (%s). errno=%d", kav_options, errno); return DEFER; @@ -665,7 +665,7 @@ int malware(uschar **listptr) { /* send scan request */ if (send(sock, scanrequest, Ustrlen(scanrequest)+1, 0) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to write to kavdaemon UNIX socket (%s)", kav_options); return DEFER; @@ -673,7 +673,7 @@ int malware(uschar **listptr) { /* wait for result */ if ((bread = recv(sock, tmpbuf, 2, 0) != 2)) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to read 2 bytes from kavdaemon socket."); return DEFER; @@ -689,21 +689,21 @@ int malware(uschar **listptr) { /* improper kavdaemon configuration */ if ( (kav_rc == 5) || (kav_rc == 6) ) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: please reconfigure kavdaemon to NOT disinfect or remove infected files."); return DEFER; }; if (kav_rc == 1) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: kavdaemon reported 'scanning not completed' (code 1)."); return DEFER; }; if (kav_rc == 7) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: kavdaemon reported 'kavdaemon damaged' (code 7)."); return DEFER; @@ -731,7 +731,7 @@ int malware(uschar **listptr) { if( report_flag == 1 ) { /* read report size */ if ((bread = recv(sock, &kav_reportlen, 4, 0)) != 4) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: cannot read report size from kavdaemon"); return DEFER; @@ -781,7 +781,7 @@ int malware(uschar **listptr) { malware_name = NULL; }; - close(sock); + (void)close(sock); } /* ----------------------------------------------------------------------- */ @@ -900,7 +900,7 @@ int malware(uschar **listptr) { trigger = 1; }; - fclose(scanner_record); + (void)fclose(scanner_record); pclose(scanner_out); signal(SIGCHLD,eximsigchld); signal(SIGPIPE,eximsigpipe); @@ -919,7 +919,7 @@ int malware(uschar **listptr) { pcre_copy_substring(CS linebuffer, ovector, result, 1, CS malware_name_buffer, 255); }; }; - fclose(scanner_record); + (void)fclose(scanner_record); } else { /* no virus found */ @@ -957,7 +957,7 @@ int malware(uschar **listptr) { server.sun_family = AF_UNIX; Ustrcpy(server.sun_path, sophie_options); if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to connect to sophie UNIX socket (%s). errno=%d", sophie_options, errno); return DEFER; @@ -966,24 +966,24 @@ int malware(uschar **listptr) { /* pass the scan directory to sophie */ snprintf(CS file_name,1024,"%s/scan/%s", spool_directory, message_id); if (write(sock, file_name, Ustrlen(file_name)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to write to sophie UNIX socket (%s)", sophie_options); return DEFER; }; - write(sock, "\n", 1); + (void)write(sock, "\n", 1); /* wait for result */ memset(av_buffer, 0, sizeof(av_buffer)); if ((!(bread = read(sock, av_buffer, sizeof(av_buffer))) > 0)) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to read from sophie UNIX socket (%s)", sophie_options); return DEFER; }; - close(sock); + (void)close(sock); /* infected ? */ if (av_buffer[0] == '1') { @@ -1068,7 +1068,7 @@ int malware(uschar **listptr) { } if (ip_connect(sock, AF_INET, (uschar*)inet_ntoa(in), port, 5) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: clamd: connection to %s, port %u failed (%s)", inet_ntoa(in), port, strerror(errno)); @@ -1082,7 +1082,7 @@ int malware(uschar **listptr) { snprintf(CS file_name,1024,"SCAN %s/scan/%s\n", spool_directory, message_id); if (send(sock, file_name, Ustrlen(file_name), 0) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC,"malware acl condition: clamd: unable to write to socket (%s)", strerror(errno)); return DEFER; @@ -1092,7 +1092,7 @@ int malware(uschar **listptr) { /* Pass the string to ClamAV (7 = "STREAM\n") */ if (send(sock, "STREAM\n", 7, 0) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC,"malware acl condition: clamd: unable to write to socket (%s)", strerror(errno)); return DEFER; @@ -1134,7 +1134,7 @@ int malware(uschar **listptr) { } if (ip_connect(sockData, AF_INET, (uschar*)inet_ntoa(in), port, 5) < 0) { - close(sockData); + (void)close(sockData); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: clamd: connection to %s, port %u failed (%s)", inet_ntoa(in), port, strerror(errno)); @@ -1163,8 +1163,8 @@ int malware(uschar **listptr) { clamav_fbuf = (uschar *) malloc (fsize); if (!clamav_fbuf) { - close(sockData); - close(clam_fd); + (void)close(sockData); + (void)close(clam_fd); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: clamd: unable to allocate memory %u for file (%s)", fsize, scanrequest); @@ -1173,26 +1173,26 @@ int malware(uschar **listptr) { result = read (clam_fd, clamav_fbuf, fsize); if (result == -1) { - close(sockData); - close(clam_fd); + (void)close(sockData); + (void)close(clam_fd); free(clamav_fbuf); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: clamd: can't read spool file %s: %s", scanrequest, strerror(errno)); return DEFER; } - close(clam_fd); + (void)close(clam_fd); /* send file body to socket */ if (send(sockData, clamav_fbuf, fsize, 0) < 0) { - close(sockData); + (void)close(sockData); free(clamav_fbuf); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: clamd: unable to send file body to socket (%s:%u)", hostname, port); return DEFER; } free(clamav_fbuf); - close(sockData); + (void)close(sockData); } } else { @@ -1208,7 +1208,7 @@ int malware(uschar **listptr) { Ustrcpy(server.sun_path, clamd_options); if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: clamd: unable to connect to UNIX socket %s (%s)", clamd_options, strerror(errno) ); @@ -1221,7 +1221,7 @@ int malware(uschar **listptr) { snprintf(CS file_name,1024,"SCAN %s/scan/%s\n", spool_directory, message_id); if (send(sock, file_name, Ustrlen(file_name), 0) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC,"malware acl condition: clamd: unable to write to socket (%s)", strerror(errno)); return DEFER; @@ -1239,7 +1239,7 @@ int malware(uschar **listptr) { /* Read the result */ memset(av_buffer, 0, sizeof(av_buffer)); bread = read(sock, av_buffer, sizeof(av_buffer)); - close(sock); + (void)close(sock); if (!(bread > 0)) { log_write(0, LOG_MAIN|LOG_PANIC, @@ -1339,7 +1339,7 @@ int malware(uschar **listptr) { server.sun_family = AF_UNIX; Ustrcpy(server.sun_path, "/var/run/mksd/socket"); if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); + (void)close(sock); log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: unable to connect to mksd UNIX socket (/var/run/mksd/socket). errno=%d", errno); return DEFER; diff --git a/src/src/match.c b/src/src/match.c index 18f1a3791..a957da30e 100644 --- a/src/src/match.c +++ b/src/src/match.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/match.c,v 1.6 2005/06/22 10:17:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/match.c,v 1.7 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -783,13 +783,13 @@ while ((sss = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL) switch ((func)(arg, ss, valueptr, &error)) { case OK: - fclose(f); + (void)fclose(f); HDEBUG(D_lists) debug_printf("%s %s (matched \"%s\" in %s)\n", ot, (yield == OK)? "yes" : "no", sss, filename); return file_yield; case DEFER: - fclose(f); + (void)fclose(f); goto DEFER_RETURN; case ERROR: /* host name lookup failed - this can only */ @@ -802,7 +802,7 @@ while ((sss = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL) { HDEBUG(D_lists) debug_printf("%s %s (%s)\n", ot, include_unknown? "yes":"no", error); - fclose(f); + (void)fclose(f); if (!include_unknown) return FAIL; log_write(0, LOG_MAIN, "%s: accepted by +include_unknown", error); return OK; @@ -814,7 +814,7 @@ while ((sss = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL) for the file, in case this is the last item in the list. */ yield = file_yield; - fclose(f); + (void)fclose(f); } } /* Loop for the next item on the top-level list */ diff --git a/src/src/mime.c b/src/src/mime.c index 05b6e3e2a..52c92ca85 100644 --- a/src/src/mime.c +++ b/src/src/mime.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/mime.c,v 1.7 2005/04/04 10:33:49 ph10 Exp $ */ +/* $Cambridge: exim/src/src/mime.c,v 1.8 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -384,7 +384,7 @@ int mime_decode(uschar **listptr) { } - fclose(decode_file); + (void)fclose(decode_file); clearerr(mime_stream); fseek(mime_stream,f_pos,SEEK_SET); @@ -418,7 +418,7 @@ int mime_get_header(FILE *f, uschar *header) { c = fgetc(f); if (c == EOF) break; if ( (c == '\t') || (c == ' ') ) continue; - ungetc(c,f); + (void)ungetc(c,f); }; /* end of the header, terminate with ';' */ c = ';'; diff --git a/src/src/moan.c b/src/src/moan.c index 859128199..acf701aec 100644 --- a/src/src/moan.c +++ b/src/src/moan.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/moan.c,v 1.2 2005/01/04 10:00:42 ph10 Exp $ */ +/* $Cambridge: exim/src/src/moan.c,v 1.3 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -248,7 +248,7 @@ if (message_file != NULL) /* Close the file, which should send an EOF to the child process that is receiving the message. Wait for it to finish, without a timeout. */ -fclose(f); +(void)fclose(f); status = child_close(pid, 0); /* Waits for child to close */ if (status != 0) { @@ -437,7 +437,7 @@ if (addr != NULL) } } -fclose(f); +(void)fclose(f); child_close(pid, 0); /* Waits for child to close; no timeout */ } @@ -692,7 +692,7 @@ if (some) else fprintf(f, "No valid addresses were generated.\n"); -fclose(f); +(void)fclose(f); child_close(pid, 0); /* Waits for child to close; no timeout */ return TRUE; diff --git a/src/src/os.c b/src/src/os.c index 7ca0fdabd..8488fac0c 100644 --- a/src/src/os.c +++ b/src/src/os.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/os.c,v 1.2 2005/01/04 10:00:42 ph10 Exp $ */ +/* $Cambridge: exim/src/src/os.c,v 1.3 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -696,7 +696,7 @@ for (cp = buf; cp < buf + ifc.V_ifc_len; cp += len) /* Close the socket, and return the chain of data blocks. */ -close(vs); +(void)close(vs); return yield; } diff --git a/src/src/parse.c b/src/src/parse.c index b70265862..252628e1a 100644 --- a/src/src/parse.c +++ b/src/src/parse.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/parse.c,v 1.4 2005/02/17 11:58:26 ph10 Exp $ */ +/* $Cambridge: exim/src/src/parse.c,v 1.5 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1475,7 +1475,7 @@ for (;;) { *error = string_sprintf("failed to stat included file %s: %s", filename, strerror(errno)); - fclose(f); + (void)fclose(f); return FF_INCLUDEFAIL; } @@ -1502,11 +1502,11 @@ for (;;) { *error = string_sprintf("error while reading included file %s: %s", filename, strerror(errno)); - fclose(f); + (void)fclose(f); return FF_ERROR; } filebuf[statbuf.st_size] = 0; - fclose(f); + (void)fclose(f); addr = NULL; frc = parse_forward_list(filebuf, options, &addr, diff --git a/src/src/queue.c b/src/src/queue.c index f411f3629..c234ffe26 100644 --- a/src/src/queue.c +++ b/src/src/queue.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/queue.c,v 1.7 2005/06/16 14:10:13 ph10 Exp $ */ +/* $Cambridge: exim/src/src/queue.c,v 1.8 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -594,7 +594,7 @@ for (i = (queue_run_in_order? -1 : 0); if (queue_run_pipe == 0) { queue_run_pipe = dup(queue_run_pipe); - close(0); + (void)close(0); } /* Before forking to deliver the message, ensure any open and cached @@ -627,7 +627,7 @@ for (i = (queue_run_in_order? -1 : 0); /* Close the writing end of the synchronizing pipe in this process, then wait for the first level process to terminate. */ - close(pfd[pipe_write]); + (void)close(pfd[pipe_write]); set_process_info("running queue: waiting for %s (%d)", f->text, pid); while (wait(&status) != pid); @@ -873,7 +873,7 @@ for (; f != NULL; f = f->next) big_buffer[n-1] = 0; tree_add_nonrecipient(big_buffer); } - fclose(jread); + (void)fclose(jread); } } @@ -1019,9 +1019,9 @@ if (action >= MSG_SHOW_BODY) } while((rc = read(fd, big_buffer, big_buffer_size)) > 0) - write(fileno(stdout), big_buffer, rc); + (void)write(fileno(stdout), big_buffer, rc); - close(fd); + (void)close(fd); return TRUE; } @@ -1064,7 +1064,7 @@ if (spool_read_header(spoolname, TRUE, FALSE) != spool_read_OK) printf("Spool format error for %s\n", spoolname); if (action != MSG_REMOVE || !admin_user) { - close(deliver_datafile); + (void)close(deliver_datafile); deliver_datafile = -1; return FALSE; } @@ -1079,7 +1079,7 @@ why we leave this check until after the headers are read. */ if (!admin_user && (action != MSG_REMOVE || real_uid != originator_uid)) { printf("Permission denied\n"); - close(deliver_datafile); + (void)close(deliver_datafile); deliver_datafile = -1; return FALSE; } @@ -1314,7 +1314,7 @@ switch(action) /* Closing the datafile releases the lock and permits other processes to operate on the message (if it still exists). */ -close(deliver_datafile); +(void)close(deliver_datafile); deliver_datafile = -1; return yield; } diff --git a/src/src/rda.c b/src/src/rda.c index 1be7b1cc4..06eff227e 100644 --- a/src/src/rda.c +++ b/src/src/rda.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/rda.c,v 1.7 2005/06/16 14:10:13 ph10 Exp $ */ +/* $Cambridge: exim/src/src/rda.c,v 1.8 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -302,14 +302,14 @@ filebuf[statbuf.st_size] = 0; DEBUG(D_route) debug_printf(OFF_T_FMT " bytes read from %s\n", statbuf.st_size, filename); -fclose(fwd); +(void)fclose(fwd); return filebuf; /* Return an error: the string is already set up. */ ERROR_RETURN: *yield = FF_ERROR; -fclose(fwd); +(void)fclose(fwd); return NULL; } @@ -446,8 +446,8 @@ static void rda_write_string(int fd, uschar *s) { int len = (s == NULL)? 0 : Ustrlen(s) + 1; -write(fd, &len, sizeof(int)); -if (s != NULL) write(fd, s, len); +(void)write(fd, &len, sizeof(int)); +if (s != NULL) (void)write(fd, s, len); } @@ -615,7 +615,7 @@ if ((pid = fork()) == 0) header_line *waslast = header_last; /* Save last header */ fd = pfd[pipe_write]; - close(pfd[pipe_read]); + (void)close(pfd[pipe_read]); exim_setugid(ugid->uid, ugid->gid, FALSE, rname); /* Addresses can get rewritten in filters; if we are not root or the exim @@ -638,8 +638,8 @@ if ((pid = fork()) == 0) /* Pass back whether it was a filter, and the return code and any overall error text via the pipe. */ - write(fd, filtertype, sizeof(int)); - write(fd, &yield, sizeof(int)); + (void)write(fd, filtertype, sizeof(int)); + (void)write(fd, &yield, sizeof(int)); rda_write_string(fd, *error); /* Pass back the contents of any syntax error blocks if we have a pointer */ @@ -665,10 +665,10 @@ if ((pid = fork()) == 0) header_line *h; for (h = header_list; h != waslast->next; i++, h = h->next) { - if (h->type == htype_old) write(fd, &i, sizeof(i)); + if (h->type == htype_old) (void)write(fd, &i, sizeof(i)); } i = -1; - write(fd, &i, sizeof(i)); + (void)write(fd, &i, sizeof(i)); while (waslast != header_last) { @@ -676,7 +676,7 @@ if ((pid = fork()) == 0) if (waslast->type != htype_old) { rda_write_string(fd, waslast->text); - write(fd, &(waslast->type), sizeof(waslast->type)); + (void)write(fd, &(waslast->type), sizeof(waslast->type)); } } rda_write_string(fd, NULL); /* Indicates end of added headers */ @@ -684,7 +684,7 @@ if ((pid = fork()) == 0) /* Write the contents of the $n variables */ - write(fd, filter_n, sizeof(filter_n)); + (void)write(fd, filter_n, sizeof(filter_n)); /* If the result was DELIVERED or NOTDELIVERED, we pass back the generated addresses, and their associated information, through the pipe. This is @@ -701,8 +701,8 @@ if ((pid = fork()) == 0) int reply_options = 0; rda_write_string(fd, addr->address); - write(fd, &(addr->mode), sizeof(addr->mode)); - write(fd, &(addr->flags), sizeof(addr->flags)); + (void)write(fd, &(addr->mode), sizeof(addr->mode)); + (void)write(fd, &(addr->flags), sizeof(addr->flags)); rda_write_string(fd, addr->p.errors_address); if (addr->pipe_expandn != NULL) @@ -714,15 +714,15 @@ if ((pid = fork()) == 0) rda_write_string(fd, NULL); if (addr->reply == NULL) - write(fd, &reply_options, sizeof(int)); /* 0 means no reply */ + (void)write(fd, &reply_options, sizeof(int)); /* 0 means no reply */ else { reply_options |= REPLY_EXISTS; if (addr->reply->file_expand) reply_options |= REPLY_EXPAND; if (addr->reply->return_message) reply_options |= REPLY_RETURN; - write(fd, &reply_options, sizeof(int)); - write(fd, &(addr->reply->expand_forbid), sizeof(int)); - write(fd, &(addr->reply->once_repeat), sizeof(time_t)); + (void)write(fd, &reply_options, sizeof(int)); + (void)write(fd, &(addr->reply->expand_forbid), sizeof(int)); + (void)write(fd, &(addr->reply->once_repeat), sizeof(time_t)); rda_write_string(fd, addr->reply->to); rda_write_string(fd, addr->reply->cc); rda_write_string(fd, addr->reply->bcc); @@ -742,7 +742,7 @@ if ((pid = fork()) == 0) /* OK, this process is now done. Must use _exit() and not exit() !! */ - close(fd); + (void)close(fd); _exit(0); } @@ -755,7 +755,7 @@ if (pid < 0) writing end must be closed first, as otherwise read() won't return zero on an empty pipe. Afterwards, close the reading end. */ -close(pfd[pipe_write]); +(void)close(pfd[pipe_write]); /* Read initial data, including yield and contents of *error */ @@ -940,7 +940,7 @@ else if (status != 0) } FINAL_EXIT: -close(fd); +(void)close(fd); signal(SIGCHLD, oldsignal); /* restore */ return yield; diff --git a/src/src/readconf.c b/src/src/readconf.c index b5c113014..1cc95b90d 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/readconf.c,v 1.10 2005/06/21 14:14:55 ph10 Exp $ */ +/* $Cambridge: exim/src/src/readconf.c,v 1.11 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -603,7 +603,7 @@ for (;;) { if (config_file_stack != NULL) /* EOF inside .include */ { - fclose(config_file); + (void)fclose(config_file); config_file = config_file_stack->file; config_filename = config_file_stack->filename; config_lineno = config_file_stack->lineno; @@ -3811,7 +3811,7 @@ while(next_section[0] != 0) } } -fclose(config_file); +(void)fclose(config_file); } /* End of readconf.c */ diff --git a/src/src/receive.c b/src/src/receive.c index 96ff902c6..daa260fff 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/receive.c,v 1.19 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/receive.c,v 1.20 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -303,8 +303,8 @@ if (spool_name[0] != 0) /* Now close the file if it is open, either as a fd or a stream. */ -if (data_file != NULL) fclose(data_file); - else if (data_fd >= 0) close(data_fd); +if (data_file != NULL) (void)fclose(data_file); + else if (data_fd >= 0) (void)close(data_fd); /* Attempt to close down an SMTP connection tidily. */ @@ -865,7 +865,7 @@ if (error_handling == ERRORS_SENDER) error_rc = EXIT_FAILURE; } else fprintf(stderr, "exim: %s%s\n", text2, text1); /* Sic */ -fclose(f); +(void)fclose(f); exim_exit(error_rc); } @@ -1078,7 +1078,7 @@ mime_is_rfc822 = 0; MIME_ACL_CHECK: mime_part_count = -1; rc = mime_acl_check(acl, mbox_file, NULL, &user_msg, &log_msg); -fclose(mbox_file); +(void)fclose(mbox_file); if (Ustrlen(rfc822_file_path) > 0) { mime_part_count = mime_part_count_buffer; @@ -2632,7 +2632,7 @@ if (next != NULL) { uschar *s = next->text; int len = next->slen; - fwrite(s, 1, len, data_file); + (void)fwrite(s, 1, len, data_file); body_linecount++; /* Assumes only 1 line */ } @@ -2823,7 +2823,7 @@ if (extract_recip && (bad_addresses != NULL || recipients_count == 0)) if (recipients_count == 0 || error_handling == ERRORS_STDERR) { Uunlink(spool_name); - fclose(data_file); + (void)fclose(data_file); exim_exit(error_rc); } } @@ -3409,7 +3409,7 @@ if (message_logs && blackholed_by == NULL) { log_write(0, LOG_MAIN|LOG_PANIC, "Couldn't fdopen message log %s: %s", spool_name, strerror(errno)); - close(fd); + (void)close(fd); } else { @@ -3419,7 +3419,7 @@ if (message_logs && blackholed_by == NULL) frozen_by); if (queue_only_policy) fprintf(message_log, "%s no immediate delivery: queued by %s\n", now, queued_by); - fclose(message_log); + (void)fclose(message_log); } } } @@ -3451,8 +3451,8 @@ possible for fclose() to fail - but what to do? What has happened to the lock if this happens? */ TIDYUP: -process_info[process_info_len] = 0; /* Remove message id */ -if (data_file != NULL) fclose(data_file); /* Frees the lock */ +process_info[process_info_len] = 0; /* Remove message id */ +if (data_file != NULL) (void)fclose(data_file); /* Frees the lock */ /* Now reset signal handlers to their defaults */ diff --git a/src/src/regex.c b/src/src/regex.c index c811f439f..7383f3c46 100644 --- a/src/src/regex.c +++ b/src/src/regex.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/regex.c,v 1.5 2005/05/24 08:15:02 tom Exp $ */ +/* $Cambridge: exim/src/src/regex.c,v 1.6 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -117,7 +117,7 @@ int regex(uschar **listptr) { Ustrncpy(regex_match_string_buffer, re_list_item->pcre_text, 1023); regex_match_string = regex_match_string_buffer; if (mime_stream == NULL) - fclose(mbox_file); + (void)fclose(mbox_file); else { clearerr(mime_stream); fseek(mime_stream,f_pos,SEEK_SET); @@ -129,7 +129,7 @@ int regex(uschar **listptr) { }; if (mime_stream == NULL) - fclose(mbox_file); + (void)fclose(mbox_file); else { clearerr(mime_stream); fseek(mime_stream,f_pos,SEEK_SET); @@ -232,13 +232,13 @@ int mime_regex(uschar **listptr) { mime_subject_len, 0, 0, NULL, 0) >= 0) { Ustrncpy(regex_match_string_buffer, re_list_item->pcre_text, 1023); regex_match_string = regex_match_string_buffer; - fclose(f); + (void)fclose(f); return OK; }; re_list_item = re_list_item->next; } while (re_list_item != NULL); - fclose(f); + (void)fclose(f); /* no matches ... */ return FAIL; diff --git a/src/src/routers/iplookup.c b/src/src/routers/iplookup.c index 72392fd4d..f4120d91c 100644 --- a/src/src/routers/iplookup.c +++ b/src/src/routers/iplookup.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/iplookup.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/iplookup.c,v 1.3 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -251,7 +251,7 @@ while ((hostname = string_nextinlist(&listptr, &sep, host_buffer, if (send(query_socket, query, query_len, 0) < 0) { DEBUG(D_route) debug_printf("send to %s failed\n", h->address); - close(query_socket); + (void)close(query_socket); continue; } @@ -259,7 +259,7 @@ while ((hostname = string_nextinlist(&listptr, &sep, host_buffer, next IP address. */ count = ip_recv(query_socket, reply, sizeof(reply) - 1, ob->timeout); - close(query_socket); + (void)close(query_socket); if (count <= 0) { DEBUG(D_route) debug_printf("%s from %s\n", (errno == ETIMEDOUT)? diff --git a/src/src/routers/queryprogram.c b/src/src/routers/queryprogram.c index 5282a1fa6..2aed3ef82 100644 --- a/src/src/routers/queryprogram.c +++ b/src/src/routers/queryprogram.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.4 2005/04/28 13:06:32 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.5 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -278,7 +278,7 @@ if (pid < 0) /* Nothing is written to the standard input. */ -close(fd_in); +(void)close(fd_in); /* Wait for the process to finish, applying the timeout, and inspect its return code. */ @@ -310,7 +310,7 @@ if ((rc = child_close(pid, ob->timeout)) != 0) /* Read the pipe to get the command's output, and then close it. */ len = read(fd_out, buffer, sizeof(buffer) - 1); -close(fd_out); +(void)close(fd_out); /* Failure to return any data is an error. */ diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 02264d280..a87e79611 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_in.c,v 1.19 2005/05/23 16:58:56 fanf2 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.20 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2593,7 +2593,7 @@ while (done <= 0) if (tls_active >= 0) (void)tls_write(s, ptr); else #endif - fwrite(s, 1, ptr, smtp_out); + (void)fwrite(s, 1, ptr, smtp_out); DEBUG(D_receive) debug_printf("SMTP>> %s", s); helo_seen = TRUE; break; /* HELO/EHLO */ @@ -3483,9 +3483,9 @@ while (done <= 0) if ((pid = fork()) == 0) { - smtp_input = FALSE; /* This process is not associated with the */ - fclose(smtp_in); /* SMTP call any more. */ - fclose(smtp_out); + smtp_input = FALSE; /* This process is not associated with the */ + (void)fclose(smtp_in); /* SMTP call any more. */ + (void)fclose(smtp_out); signal(SIGCHLD, SIG_DFL); /* Want to catch child */ diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index 2caa775fc..696cfff5d 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_out.c,v 1.4 2005/02/17 11:58:26 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_out.c,v 1.5 2005/06/27 14:29:43 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -230,7 +230,7 @@ if (save_errno != 0) debug_printf(" (timeout=%s)", readconf_printtime(timeout)); debug_printf("\n"); } - close(sock); + (void)close(sock); errno = save_errno; return -1; } diff --git a/src/src/spam.c b/src/src/spam.c index 9544ff646..0095bb9bc 100644 --- a/src/src/spam.c +++ b/src/src/spam.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spam.c,v 1.8 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/spam.c,v 1.9 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -120,7 +120,7 @@ int spam(uschar **listptr) { if (!num_servers) { log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: no useable spamd server addresses in spamd_address configuration option."); - fclose(mbox_file); + (void)fclose(mbox_file); return DEFER; }; @@ -136,7 +136,7 @@ int spam(uschar **listptr) { if ( (spamd_sock = ip_socket(SOCK_STREAM, AF_INET)) < 0) { log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: error creating IP socket for spamd"); - fclose(mbox_file); + (void)fclose(mbox_file); return DEFER; }; @@ -159,8 +159,8 @@ int spam(uschar **listptr) { current_server = 0; if (current_server == start_server) { log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: all spamd servers failed"); - fclose(mbox_file); - close(spamd_sock); + (void)fclose(mbox_file); + (void)close(spamd_sock); return DEFER; }; }; @@ -173,7 +173,7 @@ int spam(uschar **listptr) { log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: spamd: unable to acquire socket (%s)", strerror(errno)); - fclose(mbox_file); + (void)fclose(mbox_file); return DEFER; } @@ -184,8 +184,8 @@ int spam(uschar **listptr) { log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: spamd: unable to connect to UNIX socket %s (%s)", spamd_address, strerror(errno) ); - fclose(mbox_file); - close(spamd_sock); + (void)fclose(mbox_file); + (void)close(spamd_sock); return DEFER; } @@ -200,11 +200,11 @@ int spam(uschar **listptr) { /* send our request */ if (send(spamd_sock, spamd_buffer, Ustrlen(spamd_buffer), 0) < 0) { - close(spamd_sock); + (void)close(spamd_sock); log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: spamd send failed: %s", strerror(errno)); - fclose(mbox_file); - close(spamd_sock); + (void)fclose(mbox_file); + (void)close(spamd_sock); return DEFER; }; @@ -241,8 +241,8 @@ again: log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: timed out writing spamd socket"); } - close(spamd_sock); - fclose(mbox_file); + (void)close(spamd_sock); + (void)fclose(mbox_file); return DEFER; } #endif @@ -251,8 +251,8 @@ again: { log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: %s on spamd socket", strerror(errno)); - close(spamd_sock); - fclose(mbox_file); + (void)close(spamd_sock); + (void)fclose(mbox_file); return DEFER; } if (offset + wrote != read) { @@ -265,12 +265,12 @@ again: if (ferror(mbox_file)) { log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: error reading spool file: %s", strerror(errno)); - close(spamd_sock); - fclose(mbox_file); + (void)close(spamd_sock); + (void)fclose(mbox_file); return DEFER; } - fclose(mbox_file); + (void)fclose(mbox_file); /* we're done sending, close socket for writing */ shutdown(spamd_sock,SHUT_WR); @@ -290,12 +290,12 @@ again: if((i <= 0) && (errno != 0)) { log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: error reading from spamd socket: %s", strerror(errno)); - close(spamd_sock); + (void)close(spamd_sock); return DEFER; } /* reading done */ - close(spamd_sock); + (void)close(spamd_sock); /* dig in the spamd output and put the report in a multiline header, if requested */ if( sscanf(CS spamd_buffer,"SPAMD/%s 0 EX_OK\r\nContent-length: %*u\r\n\r\n%lf/%lf\r\n%n", diff --git a/src/src/spool_in.c b/src/src/spool_in.c index e64ca9925..6efe5aa27 100644 --- a/src/src/spool_in.c +++ b/src/src/spool_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spool_in.c,v 1.11 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/spool_in.c,v 1.12 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -89,7 +89,7 @@ if (fcntl(deliver_datafile, F_SETLK, &lock_data) < 0) log_write(L_skip_delivery, LOG_MAIN, "Spool file is locked (another process is handling this message)"); - close(deliver_datafile); + (void)close(deliver_datafile); deliver_datafile = -1; errno = 0; return FALSE; diff --git a/src/src/spool_mbox.c b/src/src/spool_mbox.c index d1cae29a1..70926811d 100644 --- a/src/src/spool_mbox.c +++ b/src/src/spool_mbox.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spool_mbox.c,v 1.6 2005/06/06 18:49:35 tom Exp $ */ +/* $Cambridge: exim/src/src/spool_mbox.c,v 1.7 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -70,7 +70,7 @@ FILE *spool_mbox(unsigned long *mbox_file_size) { i = fwrite(mbox_delimiter, 1, Ustrlen(mbox_delimiter), mbox_file); if (i != Ustrlen(mbox_delimiter)) { debug_printf("error/short write on writing in: %s", mbox_path); - fclose(mbox_file); + (void)fclose(mbox_file); return NULL; }; }; @@ -84,7 +84,7 @@ FILE *spool_mbox(unsigned long *mbox_file_size) { i = fwrite(my_envelope_from, 1, Ustrlen(my_envelope_from), mbox_file); if (i != Ustrlen(my_envelope_from)) { debug_printf("error/short write on writing in: %s", mbox_path); - fclose(mbox_file); + (void)fclose(mbox_file); return NULL; }; }; @@ -98,7 +98,7 @@ FILE *spool_mbox(unsigned long *mbox_file_size) { i = fwrite(my_envelope_to, 1, Ustrlen(my_envelope_to), mbox_file); if (i != Ustrlen(my_envelope_to)) { debug_printf("error/short write on writing in: %s", mbox_path); - fclose(mbox_file); + (void)fclose(mbox_file); return NULL; }; }; @@ -117,7 +117,7 @@ FILE *spool_mbox(unsigned long *mbox_file_size) { i = fwrite(my_headerlist->text, 1, my_headerlist->slen, mbox_file); if (i != my_headerlist->slen) { debug_printf("error/short write on writing in: %s", mbox_path); - fclose(mbox_file); + (void)fclose(mbox_file); return NULL; }; @@ -134,7 +134,7 @@ FILE *spool_mbox(unsigned long *mbox_file_size) { break; }; - fread(data_buffer, 1, 18, data_file); + (void)fread(data_buffer, 1, 18, data_file); do { j = fread(data_buffer, 1, sizeof(data_buffer), data_file); @@ -142,15 +142,15 @@ FILE *spool_mbox(unsigned long *mbox_file_size) { i = fwrite(data_buffer, 1, j, mbox_file); if (i != j) { debug_printf("error/short write on writing in: %s", mbox_path); - fclose(mbox_file); - fclose(data_file); + (void)fclose(mbox_file); + (void)fclose(data_file); return NULL; }; }; } while (j > 0); - fclose(data_file); - fclose(mbox_file); + (void)fclose(data_file); + (void)fclose(mbox_file); Ustrcpy(spooled_message_id, message_id); spool_mbox_ok = 1; }; diff --git a/src/src/spool_out.c b/src/src/spool_out.c index a1a8dee3b..d5f970224 100644 --- a/src/src/spool_out.c +++ b/src/src/spool_out.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spool_out.c,v 1.7 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/spool_out.c,v 1.8 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -48,7 +48,7 @@ uschar *msg = (where == SW_RECEIVING)? strerror(errno)); if (temp_name != NULL) Uunlink(temp_name); -if (f != NULL) fclose(f); +if (f != NULL) (void)fclose(f); if (errmsg == NULL) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "%s", msg); diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index aedf09bc2..a3ecbeb10 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/tls-gnu.c,v 1.8 2005/06/16 14:10:13 ph10 Exp $ */ +/* $Cambridge: exim/src/src/tls-gnu.c,v 1.9 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -856,8 +856,8 @@ if (rc < 0) if (!sigalrm_seen) { - fclose(smtp_out); - fclose(smtp_in); + (void)fclose(smtp_out); + (void)fclose(smtp_in); } return FAIL; diff --git a/src/src/transport.c b/src/src/transport.c index e2ae60b3d..a75a2dfa0 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transport.c,v 1.11 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transport.c,v 1.12 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1090,7 +1090,7 @@ dk_transport_write_message(address_item *addr, int fd, int options, CLEANUP: /* unlink -K file */ - close(dk_fd); + (void)close(dk_fd); Uunlink(dk_spool_name); errno = save_errno; return rc; @@ -1182,25 +1182,25 @@ if (pipe(pfd) != 0) goto TIDY_UP; /* errno set */ if ((write_pid = fork()) == 0) { BOOL rc; - close(fd_read); - close(pfd[pipe_read]); + (void)close(fd_read); + (void)close(pfd[pipe_read]); nl_check_length = nl_escape_length = 0; rc = internal_transport_write_message(addr, fd_write, (options & ~(topt_use_crlf | topt_end_dot)), size_limit, add_headers, remove_headers, NULL, NULL, rewrite_rules, rewrite_existflags); save_errno = errno; - write(pfd[pipe_write], (void *)&rc, sizeof(BOOL)); - write(pfd[pipe_write], (void *)&save_errno, sizeof(int)); - write(pfd[pipe_write], (void *)&(addr->more_errno), sizeof(int)); + (void)write(pfd[pipe_write], (void *)&rc, sizeof(BOOL)); + (void)write(pfd[pipe_write], (void *)&save_errno, sizeof(int)); + (void)write(pfd[pipe_write], (void *)&(addr->more_errno), sizeof(int)); _exit(0); } save_errno = errno; /* Parent process: close our copy of the writing subprocess' pipes. */ -close(pfd[pipe_write]); -close(fd_write); +(void)close(pfd[pipe_write]); +(void)close(fd_write); fd_write = -1; /* Writing process creation failed */ @@ -1270,8 +1270,8 @@ sure. Also apply a paranoia timeout. */ TIDY_UP: save_errno = errno; -close(fd_read); -if (fd_write > 0) close(fd_write); +(void)close(fd_read); +if (fd_write > 0) (void)close(fd_write); if (!yield) { @@ -1303,11 +1303,11 @@ if (write_pid > 0) if (rc == 0) { BOOL ok; - read(pfd[pipe_read], (void *)&ok, sizeof(BOOL)); + (void)read(pfd[pipe_read], (void *)&ok, sizeof(BOOL)); if (!ok) { - read(pfd[pipe_read], (void *)&save_errno, sizeof(int)); - read(pfd[pipe_read], (void *)&(addr->more_errno), sizeof(int)); + (void)read(pfd[pipe_read], (void *)&save_errno, sizeof(int)); + (void)read(pfd[pipe_read], (void *)&(addr->more_errno), sizeof(int)); yield = FALSE; } } @@ -1320,7 +1320,7 @@ if (write_pid > 0) } } } -close(pfd[pipe_read]); +(void)close(pfd[pipe_read]); /* If there have been no problems we can now add the terminating "." if this is SMTP output, turning off escaping beforehand. If the last character from the @@ -1784,8 +1784,8 @@ if ((pid = fork()) == 0) if (socket_fd != 0) { - dup2(socket_fd, 0); - close(socket_fd); + (void)dup2(socket_fd, 0); + (void)close(socket_fd); } DEBUG(D_exec) debug_print_argv(argv); diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index a2b7cfcb6..efce52622 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/appendfile.c,v 1.9 2005/06/22 15:44:38 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/appendfile.c,v 1.10 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -602,7 +602,7 @@ for (h = &host; h != NULL; h = h->next) (void)ip_connect(sock, host_af, h->address, ntohs(sp->s_port), 0); rc = send(sock, buffer, Ustrlen(buffer) + 1, 0); - close(sock); + (void)close(sock); if (rc >= 0) break; DEBUG(D_transport) @@ -1430,7 +1430,7 @@ if (!isdirectory) if (cfd >= 0) { transport_instance *tt = check_file_format(cfd, tblock, addr); - close(cfd); + (void)close(cfd); /* If another transport is indicated, call it and return; if no transport was found, just return - the error data will have been set up.*/ @@ -1622,7 +1622,7 @@ if (!isdirectory) sufficiently worried. */ if ((rc = Ulink(hitchname, lockname)) != 0) fstat(hd, &statbuf); - close(hd); + (void)close(hd); Uunlink(hitchname); if (rc != 0 && statbuf.st_nlink != 2) { @@ -2023,7 +2023,7 @@ if (!isdirectory) DEBUG(D_transport) debug_printf("failed to lock %s: %s\n", mbx_lockname, strerror(errno)); - close(mbx_lockfd); + (void)close(mbx_lockfd); mbx_lockfd = -1; } else @@ -2039,7 +2039,7 @@ if (!isdirectory) DEBUG(D_transport) debug_printf("fcntl(), flock(), or MBX locking failed - retrying\n"); - close(fd); + (void)close(fd); fd = -1; use_lstat = TRUE; /* Reset to use lstat first */ @@ -2468,7 +2468,7 @@ else addr->transport_return = PANIC; addr->message = string_sprintf("fdopen of %s (" "for %s transport) failed", filename, tblock->name); - close(fd); + (void)close(fd); Uunlink(filename); return FALSE; } @@ -2486,7 +2486,7 @@ else addr->message = string_sprintf("Expansion of \"%s\" (mailstore " "prefix for %s transport) failed: %s", ob->mailstore_prefix, tblock->name, expand_string_message); - fclose(env_file); + (void)fclose(env_file); Uunlink(filename); return FALSE; } @@ -2515,7 +2515,7 @@ else addr->message = string_sprintf("Expansion of \"%s\" (mailstore " "suffix for %s transport) failed: %s", ob->mailstore_suffix, tblock->name, expand_string_message); - fclose(env_file); + (void)fclose(env_file); Uunlink(filename); return FALSE; } @@ -2732,7 +2732,7 @@ if (temp_file != NULL && ob->mbx_format) /* Preserve errno while closing the temporary file. */ mbx_save_errno = errno; - fclose(temp_file); + (void)fclose(temp_file); errno = mbx_save_errno; } #endif /* SUPPORT_MBX */ @@ -2755,7 +2755,7 @@ if (yield == OK && maildirsize_fd >= 0) maildir_record_length(maildirsize_fd, message_size); maildir_save_errno = errno; /* Preserve errno while closing the file */ -close(maildirsize_fd); +(void)close(maildirsize_fd); errno = maildir_save_errno; #endif /* SUPPORT_MAILDIR */ @@ -3130,7 +3130,7 @@ if (mbx_lockfd >= 0) debug_printf("unlinking MBX lock file %s\n", mbx_lockname); Uunlink(mbx_lockname); } - close(mbx_lockfd); + (void)close(mbx_lockfd); } #endif /* SUPPORT_MBX */ diff --git a/src/src/transports/autoreply.c b/src/src/transports/autoreply.c index e6a29318f..02ac4f7b1 100644 --- a/src/src/transports/autoreply.c +++ b/src/src/transports/autoreply.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/autoreply.c,v 1.4 2005/06/16 14:10:14 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/autoreply.c,v 1.5 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -530,8 +530,8 @@ if (oncelog != NULL && to != NULL) uschar *ptr = log_buffer; sprintf(CS ptr, "%s\n previously sent to %.200s\n", tod_stamp(tod_log), to); while(*ptr) ptr++; - write(log_fd, log_buffer, ptr - log_buffer); - close(log_fd); + (void)write(log_fd, log_buffer, ptr - log_buffer); + (void)close(log_fd); } goto END_OFF; } @@ -667,7 +667,7 @@ if (return_message) /* End the message and wait for the child process to end; no timeout. */ -fclose(f); +(void)fclose(f); rc = child_close(pid, 0); /* Update the "sent to" log whatever the yield. This errs on the side of @@ -702,7 +702,7 @@ if (cache_fd >= 0) } memcpy(cache_time, &now, sizeof(time_t)); - write(cache_fd, from, size); + (void)write(cache_fd, from, size); } /* Update DBM file */ @@ -798,8 +798,8 @@ if (logfile != NULL) " %s\n", headers); while(*ptr) ptr++; } - write(log_fd, log_buffer, ptr - log_buffer); - close(log_fd); + (void)write(log_fd, log_buffer, ptr - log_buffer); + (void)close(log_fd); } else DEBUG(D_transport) debug_printf("Failed to open log file %s for %s " "transport: %s\n", logfile, tblock->name, strerror(errno)); @@ -807,7 +807,7 @@ if (logfile != NULL) END_OFF: if (dbm_file != NULL) EXIM_DBCLOSE(dbm_file); -if (cache_fd > 0) close(cache_fd); +if (cache_fd > 0) (void)close(cache_fd); DEBUG(D_transport) debug_printf("%s transport succeeded\n", tblock->name); diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c index be7dc8ef4..af3b2589a 100644 --- a/src/src/transports/lmtp.c +++ b/src/src/transports/lmtp.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/lmtp.c,v 1.4 2005/02/17 11:58:27 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/lmtp.c,v 1.5 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -740,8 +740,8 @@ RETURN: (void)child_close(pid, timeout); -if (fd_in >= 0) (void) close(fd_in); -if (fd_out >= 0) (void) fclose(out); +if (fd_in >= 0) (void)close(fd_in); +if (fd_out >= 0) (void)fclose(out); DEBUG(D_transport) debug_printf("%s transport yields %d\n", tblock->name, yield); diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 6fbadfb46..fe32e1267 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/pipe.c,v 1.6 2005/05/10 11:13:09 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/pipe.c,v 1.7 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -640,8 +640,8 @@ if ((outpid = fork()) < 0) addr->message = string_sprintf( "Failed to create process for handling output in %s transport", tblock->name); - close(fd_in); - close(fd_out); + (void)close(fd_in); + (void)close(fd_out); return FALSE; } @@ -654,7 +654,7 @@ the subprocess to fail. */ if (outpid == 0) { int count = 0; - close(fd_in); + (void)close(fd_in); set_process_info("reading output from |%s", cmd); while ((rc = read(fd_out, big_buffer, big_buffer_size)) > 0) { @@ -671,11 +671,11 @@ if (outpid == 0) break; } } - close(fd_out); + (void)close(fd_out); _exit(0); } -close(fd_out); /* Not used in this process */ +(void)close(fd_out); /* Not used in this process */ /* Carrying on now with the main parent process. Attempt to write the message diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 69b1c1965..a78966430 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/smtp.c,v 1.11 2005/04/28 13:06:32 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/smtp.c,v 1.12 2005/06/27 14:29:45 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1866,7 +1866,7 @@ writing RSET might have failed, or there may be other addresses whose hosts are specified in the transports, and therefore not visible at top level, in which case continue_more won't get set. */ -close(inblock.sock); +(void)close(inblock.sock); continue_transport = NULL; continue_hostname = NULL; return yield; @@ -1919,7 +1919,7 @@ outblock.authenticating = FALSE; (void)smtp_write_command(&outblock, FALSE, "QUIT\r\n"); (void)smtp_read_response(&inblock, buffer, sizeof(buffer), '2', ob->command_timeout); -close(inblock.sock); +(void)close(inblock.sock); } diff --git a/src/src/transports/tf_maildir.c b/src/src/transports/tf_maildir.c index 5277ef092..b027ef748 100644 --- a/src/src/transports/tf_maildir.c +++ b/src/src/transports/tf_maildir.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/transports/tf_maildir.c,v 1.6 2005/06/16 14:10:14 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/tf_maildir.c,v 1.7 2005/06/27 14:29:45 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -498,7 +498,7 @@ else RECALCULATE: - if (fd >= 0) close(fd); + if (fd >= 0) (void)close(fd); old_latest = 0; filecount = 0; size = maildir_compute_size(path, &filecount, &old_latest, regex, dir_regex, @@ -516,7 +516,7 @@ else len = Ustrlen(buffer); if (write(fd, buffer, len) != len || Urename(tempname, filename) < 0) { - close(fd); + (void)close(fd); fd = -1; } } @@ -532,7 +532,7 @@ else DEBUG(D_transport) debug_printf("abandoning maildirsize because of " "a later subdirectory modification\n"); (void)Uunlink(filename); - close(fd); + (void)close(fd); fd = -1; } } diff --git a/src/src/verify.c b/src/src/verify.c index 9d99c69cd..e4b25beaf 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/verify.c,v 1.21 2005/06/23 10:02:13 ph10 Exp $ */ +/* $Cambridge: exim/src/src/verify.c,v 1.22 2005/06/27 14:29:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -667,7 +667,7 @@ for (host = host_list; host != NULL && !done; host = host->next) /* End the SMTP conversation and close the connection. */ if (send_quit) (void)smtp_write_command(&outblock, FALSE, "QUIT\r\n"); - close(inblock.sock); + (void)close(inblock.sock); } /* Loop through all hosts, while !done */ /* If we get here with done == TRUE, a successful callout happened, and yield @@ -1797,7 +1797,7 @@ sender_ident = string_printing(string_copyn(p, 127)); DEBUG(D_ident) debug_printf("sender_ident = %s\n", sender_ident); END_OFF: -close(sock); +(void)close(sock); return; }