# HG changeset patch # User John W. Eaton # Date 1339068462 14400 # Node ID 0ab3dd0fad1863b4742b2915fb234de3cb13c96f # Parent c827d74a643b48674d2252b9b57d3ece8f742657 Backout changeset a543ed02e673: mkdir-p diff -r c827d74a643b -r 0ab3dd0fad18 build-aux/bootstrap.conf --- a/build-aux/bootstrap.conf Tue Jun 05 16:31:02 2012 -0700 +++ b/build-aux/bootstrap.conf Thu Jun 07 07:27:42 2012 -0400 @@ -40,7 +40,6 @@ link lstat mkdir - mkdir-p mkfifo mkostemp mkstemp @@ -57,7 +56,6 @@ rmdir round roundf - savewd sigaction signal sigprocmask diff -r c827d74a643b -r 0ab3dd0fad18 liboctave/file-ops.cc --- a/liboctave/file-ops.cc Tue Jun 05 16:31:02 2012 -0700 +++ b/liboctave/file-ops.cc Thu Jun 07 07:27:42 2012 -0400 @@ -48,7 +48,6 @@ #include "quit.h" #include "singleton-cleanup.h" #include "str-vec.h" -#include "lo-cutils.h" file_ops *file_ops::instance = 0; @@ -362,32 +361,22 @@ : dir + dir_sep_char () + file); } -static int -make_ancestor (const char *, const char *component, void *options) -{ - mode_t* mode = reinterpret_cast(options); - return gnulib::mkdir (component, *mode); -} int octave_mkdir (const std::string& nm, mode_t md) { std::string msg; - return octave_mkdir (nm, md, msg, false); + return octave_mkdir (nm, md, msg); } int -octave_mkdir (const std::string& name, mode_t mode, std::string& msg, - bool make_parents) +octave_mkdir (const std::string& name, mode_t mode, std::string& msg) { msg = std::string (); int status = -1; - if (make_parents) - status = octave_mkdir_parents (name.c_str (), mode, make_ancestor); - else - status = gnulib::mkdir (name.c_str (), mode); + status = gnulib::mkdir (name.c_str (), mode); if (status < 0) msg = gnulib::strerror (errno); diff -r c827d74a643b -r 0ab3dd0fad18 liboctave/file-ops.h --- a/liboctave/file-ops.h Tue Jun 05 16:31:02 2012 -0700 +++ b/liboctave/file-ops.h Thu Jun 07 07:27:42 2012 -0400 @@ -122,8 +122,7 @@ octave_mkdir (const std::string& nm, mode_t md); extern OCTAVE_API int -octave_mkdir (const std::string& nm, mode_t md, std::string& msg, - bool make_parents = false); +octave_mkdir (const std::string& nm, mode_t md, std::string& msg); extern OCTAVE_API int octave_mkfifo (const std::string& nm, mode_t md); diff -r c827d74a643b -r 0ab3dd0fad18 liboctave/lo-cutils.c --- a/liboctave/lo-cutils.c Tue Jun 05 16:31:02 2012 -0700 +++ b/liboctave/lo-cutils.c Thu Jun 07 07:27:42 2012 -0400 @@ -32,7 +32,6 @@ #endif #include -#include #include #include @@ -42,9 +41,6 @@ #include "lo-cutils.h" #include "syswait.h" -#include "savewd.h" -#include "mkdir-p.h" - OCTAVE_API void octave_qsort (void *base, size_t n, size_t size, int (*cmp) (const void *, const void *)) @@ -80,48 +76,3 @@ { return WAITPID (pid, status, options); } - -struct mkdir_options -{ - int (*make_ancestor_function) (const char *, const char *, void *); - mode_t ancestor_mode; - mode_t mode; - mode_t mode_bits; -}; - -static void -announce_mkdir (const char *dir, void *options) -{ - (void) dir; - (void) options; - /* Do nothing */ -} - -static int -process_dir (char *dir, struct savewd *wd, void *options) -{ - struct mkdir_options const *o = options; - mode_t ancestor_mode = o->ancestor_mode; - return (make_dir_parents (dir, wd, o->make_ancestor_function, &ancestor_mode, - o->mode, announce_mkdir, o->mode_bits, - (uid_t) -1, (gid_t) -1, false) ? 0 : -1); -} - -OCTAVE_API int -octave_mkdir_parents (const char *dir, mode_t mode, - int (*make_ancestor) (const char *, const char *, void *)) -{ - char *argv[1]; - int retval; - char *dir2 = malloc (strlen (dir) + 1); - strcpy (dir2, dir); /* Make a copy to avoid passing a const char* as char* */ - argv[0] = dir2; - struct mkdir_options o; - o.make_ancestor_function = make_ancestor; - o.ancestor_mode = mode | S_IWUSR | S_IXUSR; - o.mode = mode | umask(0); - o.mode_bits = ~(mode & umask(0)); - retval = (savewd_process_files (1, argv, process_dir, &o)); - free (dir2); - return retval; -} diff -r c827d74a643b -r 0ab3dd0fad18 liboctave/lo-cutils.h --- a/liboctave/lo-cutils.h Tue Jun 05 16:31:02 2012 -0700 +++ b/liboctave/lo-cutils.h Thu Jun 07 07:27:42 2012 -0400 @@ -50,10 +50,6 @@ OCTAVE_API pid_t octave_waitpid (pid_t pid, int *status, int options); -OCTAVE_API int -octave_mkdir_parents (const char *dir, mode_t mode, - int (*make_ancestor) (char const *, char const *, void *)); - #ifdef __cplusplus } #endif diff -r c827d74a643b -r 0ab3dd0fad18 src/dirfns.cc --- a/src/dirfns.cc Tue Jun 05 16:31:02 2012 -0700 +++ b/src/dirfns.cc Thu Jun 07 07:27:42 2012 -0400 @@ -271,7 +271,7 @@ } else { - int status = octave_mkdir (dirname, 0777, msg, true); + int status = octave_mkdir (dirname, 0777, msg); if (status < 0) {