summaryrefslogtreecommitdiffstats
path: root/server/log.c
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2020-03-16 13:19:59 +0100
committerJoe Orton <jorton@apache.org>2020-03-16 13:19:59 +0100
commit845110441e394ff8f2d75782b85d1f6887ccc635 (patch)
treea2a2cd31e2da82b571a08c311bb33f1edb0f39b3 /server/log.c
parent* server/log.c (ap_log_pid): Use a temporary file, then rename once (diff)
downloadapache2-845110441e394ff8f2d75782b85d1f6887ccc635.tar.xz
apache2-845110441e394ff8f2d75782b85d1f6887ccc635.zip
* server/log.c (ap_log_pid): Use more traditional C style in httpd for
exception-handling. No functional change. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875240 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/log.c')
-rw-r--r--server/log.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/server/log.c b/server/log.c
index 07fb358a2a..cc32f58bc5 100644
--- a/server/log.c
+++ b/server/log.c
@@ -1570,14 +1570,10 @@ AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *filename)
apr_snprintf(pidstr, sizeof pidstr, "%" APR_PID_T_FMT APR_EOL_STR, mypid);
perms = APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD;
- rv = apr_file_perms_set(temp_fname, perms);
- if (rv == APR_SUCCESS)
- rv = apr_file_write_full(pid_file, pidstr, strlen(pidstr), NULL);
- if (rv == APR_SUCCESS)
- rv = apr_file_close(pid_file);
- if (rv == APR_SUCCESS)
- rv = apr_file_rename(temp_fname, fname, p);
- if (rv != APR_SUCCESS) {
+ if ((rv = apr_file_perms_set(temp_fname, perms)) != APR_SUCCESS
+ || (rv = apr_file_write_full(pid_file, pidstr, strlen(pidstr), NULL)) != APR_SUCCESS
+ || (rv = apr_file_close(pid_file)) != APR_SUCCESS
+ || (rv = apr_file_rename(temp_fname, fname, p)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, APLOGNO(10231)
"%s: Failed creating pid file %s",
ap_server_argv0, temp_fname);