]> granicus.if.org Git - apache/commitdiff
htpasswd: Improve out of disk space handling
authorStefan Fritsch <sf@apache.org>
Mon, 19 Oct 2009 21:41:31 +0000 (21:41 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 19 Oct 2009 21:41:31 +0000 (21:41 +0000)
PR: 30877

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@826822 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
support/htpasswd.c

diff --git a/CHANGES b/CHANGES
index 702d4a6c1bb97291092c9ec7dddf0c1146cd34eb..f93bce9c24f09bf4091eae7a0cea2d374601eb28 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,8 @@ Changes with Apache 2.3.3
      mod_proxy_ftp: NULL pointer dereference on error paths.
      [Stefan Fritsch <sf fritsch.de>, Joe Orton]
 
+  *) htpasswd: Improve out of disk space handling. PR 30877. [Stefan Fritsch]
+
   *) htpasswd: Use MD5 hash by default on all platforms. [Stefan Fritsch]
 
   *) mod_sed: Reduce memory consumption when processing very long lines.
index 8022bca2e904ae9c24c5f3a8b0deaa92a565cb97..82069f5cac4b2e6e6953183290c67cfb3931e4b8 100644 (file)
@@ -141,7 +141,15 @@ static apr_status_t seed_rand(void)
 
 static void putline(apr_file_t *f, const char *l)
 {
-    apr_file_puts(l, f);
+    apr_status_t rc;
+    rc = apr_file_puts(l, f);
+    if (rc != APR_SUCCESS) {
+        char errstr[MAX_STRING_LEN];
+        apr_strerror(rc, errstr, MAX_STRING_LEN);
+        apr_file_printf(errfile, "Error writing temp file: %s" NL, errstr);
+        apr_file_close(f);
+        exit(ERR_FILEPERM);
+    }
 }
 
 /*