changeset 7418:77a75e20049c

* mkancesdirs.c (mkancesdirs): Pass to MAKE_DIR both the full file name (relative to the original working directory) and the file name component (relative to the temporary working directory). All callers changed. * mkancesdirs.h (mkancesdirs): Adjust prototype to match. * mkdir-p.c (make_dir_parents): Likewise. * mkdir-p.h (make_dir_parents): Likewise. SCALAR(0x827b260) 2006-10-06 Bruno Haible <bruno@clisp.org>
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 07 Oct 2006 07:07:34 +0000
parents fa9e9b096831
children 0c560af115cb
files lib/ChangeLog lib/mkancesdirs.c lib/mkancesdirs.h lib/mkdir-p.c lib/mkdir-p.h
diffstat 5 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,13 @@
+2006-10-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* mkancesdirs.c (mkancesdirs): Pass to MAKE_DIR both the full file
+	name (relative to the original working directory) and the file
+	name component (relative to the temporary working directory).  All
+	callers changed.
+	* mkancesdirs.h (mkancesdirs): Adjust prototype to match.
+	* mkdir-p.c (make_dir_parents): Likewise.
+	* mkdir-p.h (make_dir_parents): Likewise.
+
 2006-10-06  Eric Blake  <ebb9@byu.net>
 
 	* clean-temp.h (close_stream_temp): New declaration.
@@ -20,7 +30,7 @@
 	* clean-temp.c (PATH_MAX): Provide a fallback for GNU Hurd.
 	Reported by Eric Blake.
 
-2006-09-29  Bruno Haible  <bruno@clisp.org>
+2006-10-06  Bruno Haible  <bruno@clisp.org>
 	and Paul Eggert  <eggert@cs.ucla.edu>
 
 	* closeout.c (close_stdout): Also close stderr.
--- a/lib/mkancesdirs.c
+++ b/lib/mkancesdirs.c
@@ -42,12 +42,12 @@
    savewd.
 
    Create any ancestor directories that don't already exist, by
-   invoking MAKE_DIR (COMPONENT, MAKE_DIR_ARG).  This function should
-   return 0 if successful and the resulting directory is readable, 1
-   if successful but the resulting directory might not be readable, -1
-   (setting errno) otherwise.  If COMPONENT is relative, it is
-   relative to the temporary working directory, which may differ from
-   *WD.
+   invoking MAKE_DIR (FILE, COMPONENT, MAKE_DIR_ARG).  This function
+   should return 0 if successful and the resulting directory is
+   readable, 1 if successful but the resulting directory might not be
+   readable, -1 (setting errno) otherwise.  If COMPONENT is relative,
+   it is relative to the temporary working directory, which may differ
+   from *WD.
 
    Ordinarily MAKE_DIR is executed with the working directory changed
    to reflect the already-made prefix, and mkancesdirs returns with
@@ -66,7 +66,7 @@
 
 ptrdiff_t
 mkancesdirs (char *file, struct savewd *wd,
-	     int (*make_dir) (char const *, void *),
+	     int (*make_dir) (char const *, char const *, void *),
 	     void *make_dir_arg)
 {
   /* Address of the previous directory separator that follows an
@@ -114,7 +114,7 @@
 		&& component[0] == '.' && component[1] == '.')
 	      made_dir = false;
 	    else
-	      switch (make_dir (component, make_dir_arg))
+	      switch (make_dir (file, component, make_dir_arg))
 		{
 		case -1:
 		  make_dir_errno = errno;
--- a/lib/mkancesdirs.h
+++ b/lib/mkancesdirs.h
@@ -1,4 +1,4 @@
 #include <stddef.h>
 struct savewd;
 ptrdiff_t mkancesdirs (char *, struct savewd *,
-		       int (*) (char const *, void *), void *);
+		       int (*) (char const *, char const *, void *), void *);
--- a/lib/mkdir-p.c
+++ b/lib/mkdir-p.c
@@ -43,7 +43,7 @@
    WD is the working directory, as in savewd.c.
 
    If MAKE_ANCESTOR is not null, create any ancestor directories that
-   don't already exist, by invoking MAKE_ANCESTOR (ANCESTOR, OPTIONS).
+   don't already exist, by invoking MAKE_ANCESTOR (DIR, ANCESTOR, OPTIONS).
    This function should return zero if successful, -1 (setting errno)
    otherwise.  In this case, DIR may be modified by storing '\0' bytes
    into it, to access the ancestor directories, and this modification
@@ -83,7 +83,7 @@
 bool
 make_dir_parents (char *dir,
 		  struct savewd *wd,
-		  int (*make_ancestor) (char const *, void *),
+		  int (*make_ancestor) (char const *, char const *, void *),
 		  void *options,
 		  mode_t mode,
 		  void (*announce) (char const *, void *),
--- a/lib/mkdir-p.h
+++ b/lib/mkdir-p.h
@@ -25,7 +25,8 @@
 struct savewd;
 bool make_dir_parents (char *dir,
 		       struct savewd *wd,
-		       int (*make_ancestor) (char const *, void *),
+		       int (*make_ancestor) (char const *, char const *,
+					     void *),
 		       void *options,
 		       mode_t mode,
 		       void (*announce) (char const *, void *),