From 24bb0dbf789a0544de1cc5e005e03b86043beea5 Mon Sep 17 00:00:00 2001 From: Jacob Welsh Date: Wed, 30 Oct 2013 12:31:01 -0400 Subject: [PATCH] Fix warn_unused_result: error checking for write() --- mod_waklog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mod_waklog.c b/mod_waklog.c index 3525b3c..8cb9124 100644 --- a/mod_waklog.c +++ b/mod_waklog.c @@ -1319,7 +1319,10 @@ waklog_init_handler (apr_pool_t * p, apr_pool_t * plog, struct sharedspace_s bob; log_error(APLOG_MARK, APLOG_ERR, 0, s, "mod_waklog: sizing our cache file %d to %d", fd, sizeof(struct sharedspace_s) ); memset( &bob, 0, sizeof(struct sharedspace_s)); - write(fd, &bob, sizeof(struct sharedspace_s)); + if ( write(fd, &bob, sizeof(struct sharedspace_s)) != sizeof(struct sharedspace_s) ) { + log_error(APLOG_MARK, APLOG_ERR, 0, s, "mod_waklog: failed to write to our cache file %s (%d)", cache_file, errno ); + exit(errno); + } log_error(APLOG_MARK, APLOG_ERR, 0, s, "mod_waklog: done sizing our cache file to %d", sizeof(struct sharedspace_s) ); } -- 2.20.1