(make_path): Reformat 3 if-stmts to test `if (newly_created_dir)' only once.
authorJim Meyering <jim@meyering.net>
Sat, 10 Jan 1998 10:28:37 +0000 (10:28 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 10 Jan 1998 10:28:37 +0000 (10:28 +0000)
Suggestion from Andreas Schwab.

lib/makepath.c

index 98e1ff573a358c7c398c62743bf5629f1d1128d7..ea0a021d863393f891379b746f4fdfb11de5ab39 100644 (file)
@@ -239,29 +239,31 @@ make_path (const char *argpath,
                }
            }
 
-         if (newly_created_dir && verbose_fmt_string != NULL)
-           fprintf (stderr, verbose_fmt_string, dirpath);
+         if (newly_created_dir)
+           {
+             if (verbose_fmt_string)
+               fprintf (stderr, verbose_fmt_string, dirpath);
 
-         if (newly_created_dir
-             && (owner != (uid_t) -1 || group != (gid_t) -1)
-             && chown (basename_dir, owner, group)
+             if ((owner != (uid_t) -1 || group != (gid_t) -1)
+                 && chown (basename_dir, owner, group)
 #if defined(AFS) && defined (EPERM)
-             && errno != EPERM
+                 && errno != EPERM
 #endif
-             )
-           {
-             error (0, errno, "%s", dirpath);
-             CLEANUP;
-             return 1;
-           }
+                 )
+               {
+                 error (0, errno, "%s", dirpath);
+                 CLEANUP;
+                 return 1;
+               }
 
-         if (newly_created_dir && re_protect)
-           {
-             struct ptr_list *new = (struct ptr_list *)
-               alloca (sizeof (struct ptr_list));
-             new->dirname_end = slash;
-             new->next = leading_dirs;
-             leading_dirs = new;
+             if (re_protect)
+               {
+                 struct ptr_list *new = (struct ptr_list *)
+                   alloca (sizeof (struct ptr_list));
+                 new->dirname_end = slash;
+                 new->next = leading_dirs;
+                 leading_dirs = new;
+               }
            }
 
          /* If we were able to save the initial working directory,