From: Jacob Welsh Date: Wed, 30 Oct 2013 16:31:01 +0000 (-0400) Subject: Fix warn_unused_result: error checking for write() X-Git-Tag: debian/1.04~4^2 X-Git-Url: https://git.hcoop.net/hcoop/debian/libapache-mod-waklog.git/commitdiff_plain/24bb0dbf789a0544de1cc5e005e03b86043beea5 Fix warn_unused_result: error checking for write() --- 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) ); }