]> granicus.if.org Git - apache/commitdiff
Move another non-exists test into the non-existing tests block, and
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 14 Sep 2002 16:43:24 +0000 (16:43 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 14 Sep 2002 16:43:24 +0000 (16:43 +0000)
  clean up the comments a bit more.

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

support/htpasswd.c

index e1917ef51acea60683a36c13cca53dee4f9e22ca..4e1d03b2c39312c50627f82fd0672e088648eec3 100644 (file)
@@ -497,25 +497,16 @@ int main(int argc, const char * const argv[])
                         "might just not work on this platform.\n");
     }
 #endif
+
+    /*
+     * Only do the file checks if we're supposed to frob it.
+     */
     if (!(mask & APHTP_NOFILE)) {
         existing_file = exists(pwfilename, pool);
-        /*
-         * Only do the file checks if we're supposed to frob it.
-         *
-         * Verify that the file exists if -c was omitted.  We give a special
-         * message if it doesn't.
-         */
-        if (!(mask & APHTP_NEWFILE) && !existing_file) {
-            apr_file_printf(errfile,
-                    "%s: cannot modify file %s; use '-c' to create it\n",
-                    argv[0], pwfilename);
-            exit(ERR_FILEPERM);
-        }
-        /*
-         * If the file exists, check that it's readable and writable.
-         * If it doesn't exist, verify that we can create it.
-         */
         if (existing_file) {
+            /*
+             * Check that this existing file is readable and writable.
+             */
             if (!accessible(pool, pwfilename, APR_READ | APR_APPEND)) {
                 apr_file_printf(errfile, "%s: cannot open file %s for "
                                 "read/write access\n", argv[0], pwfilename);
@@ -523,6 +514,18 @@ int main(int argc, const char * const argv[])
             }
         }
         else {
+            /*
+             * Error out if -c was omitted for this non-existant file.
+             */
+            if (!(mask & APHTP_NEWFILE)) {
+                apr_file_printf(errfile,
+                        "%s: cannot modify file %s; use '-c' to create it\n",
+                        argv[0], pwfilename);
+                exit(ERR_FILEPERM);
+            }
+            /*
+             * As it doesn't exist yet, verify that we can create it.
+             */
             if (!accessible(pool, pwfilename, APR_CREATE | APR_WRITE)) {
                 apr_file_printf(errfile, "%s: cannot create file %s\n",
                                 argv[0], pwfilename);