Commit Graph

46 Commits

Author SHA1 Message Date
Jim Meyering eb128f8a49 (make_path): Quote the other instance, too. 2000-07-30 16:24:51 +00:00
Jim Meyering da8dd781de Include quote.h.
(make_path): Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Give better diagnostics.
2000-07-15 13:27:30 +00:00
Jim Meyering b8c130d091 Remove old, now-unnecessary `#ifdef __MSDOS__' block. 2000-05-22 06:24:50 +00:00
Jim Meyering a3029aba6b tweak comment 2000-04-27 06:46:13 +00:00
Jim Meyering eddd846acb (S_IRWXUGO): Define.
(make_path): Always perform explicit chmod if MODE specifies any
of the `special' permission bits.
2000-04-26 12:36:43 +00:00
Jim Meyering c8d452098b (make_path): Consistently use error to output
the verbose, `created directory ...' messages.
Reported by Bernhard Rosenkraenzer.
1999-12-13 07:30:57 +00:00
Jim Meyering cbdf71ab00 (make_path): Fix long-latent bug (note others
just like it were fixed in 1998-01-02).
A user (FIXME, who?) reported that using `install -d -g foo 1/2`
only sets the group on the intermediate directory, not the final
component.  From Michael Stone.
1999-11-11 11:00:50 +00:00
Jim Meyering a440742330 (make_dir): When reporting a mkdir failure and the
target cannot be `stat'ed, use the errno from the failed mkdir call,
not the one from the stat call.  Before this change, running
`mkdir -p /no-dir/no-dir' as an unprivileged user would wrongly
elicit `No such file or directory' instead of `Permission denied'.
1999-05-06 02:10:34 +00:00
Jim Meyering c4ddb7f83a Include makepath.h libintl.h, not after it.
Otherwise, we'd get the wrong definition of PARAMS from libintl.h.
(The method of defining PARAMS in libintl.h doesn't check PROTOTYPES,
which is necessary on Irix4 since cc doesn't define __STDC__.)
From Kaveh Ghazi.
1999-05-05 03:05:11 +00:00
Jim Meyering 9afd1dd692 (make_path): Use proper mode_t types and macros.
Don't assume the traditional Unix values for mode bits.
(S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IRWXU): Define if not defined.
1999-04-26 13:13:00 +00:00
Jim Meyering 0cb6dcf585 Include locale.h and libintl.h, and define `_()'.
Mark translatable strings.
1999-01-02 05:27:32 +00:00
Jim Meyering cb1d4eb4f2 (make_dir): New function, factored out of make_path.
(make_path): Use make_dir rather than open-coding it twice.
This effectively reverses the order of the latter pair of stat/mkdir
calls and fixes a race condition bug whereby one of two concurrent
`mkdir -p' processes could fail with EEXIST.
1999-01-02 05:16:57 +00:00
Jim Meyering 65978b6328 Add my comment from ChangeLog entry for gkm's change. 1998-02-11 22:17:38 +00:00
Jim Meyering 09d96ac539 (make_path): Reformat 3 if-stmts to test `if (newly_created_dir)' only once.
Suggestion from Andreas Schwab.
1998-01-10 10:28:37 +00:00
Jim Meyering 3edbca0e04 (make_path): Put only newly created directories on the LEADING_DIRS list. 1998-01-10 10:22:30 +00:00
Jim Meyering 53bc7b04cb (make_path): Try to change ownership only if we've just created the
directory.  Fix latent bug (s/&&/||/ in two places -- also, note that
it could not be exercised via install or mkdir) whereby chown would
not be invoked when only one of owner/group is not -1.
1998-01-02 23:15:39 +00:00
Jim Meyering b2e7f8b0af (make_path) [!__STDC__]: Remove K&R-style definition. 1997-12-28 10:38:15 +00:00
Jim Meyering 40fa6cc699 (make_path): Print verbose message using fprintf, not error. 1997-10-06 13:07:14 +00:00
Jim Meyering 7a4cc2dff1 (make_path): Print message IFF the directory was
just created and the format string is non-NULL.
1997-10-06 13:03:29 +00:00
Jim Meyering d68871bdec (make_path): Chdir to `/' before starting if necessary.
Call save_cwd before while loop rather than from first iteration inside it.
1997-07-09 18:02:07 +00:00
Jim Meyering 6bb8c4e904 Add comments. 1997-07-09 14:00:27 +00:00
Jim Meyering 2499628bff (make_path): Reorder stat-then-mkdir-if-missing
calls so that mkdir is called first.  Before make_path would first
`stat' a directory, then call mkdir if it didn't exist.  But if
some other process created the directory between the stat & mkdir,
the mkdir would fail with EEXIST.  Diagnosis and suggestion from
Greg McGary.
1997-07-01 11:50:39 +00:00
Jim Meyering acdc74dbf5 Rewrite using save-cwd.c and chdir to remove quadratic component of complexity.
Before, it processed O(n^2) directory name components via stat and mkdir.
Now it's O(n).  This makes mkdir -p a lot more efficient when creating
directories with very many components.  On a Linux 2.0.30 ext2fs filesystem
this command: mkdir -p `perl -e 'print "a/" x 500'`  now runs in 0.77 seconds
(user+sys).  Contrast that with the 9.5(!) seconds it took before.
1997-06-15 13:34:47 +00:00
Jim Meyering 895c2213db libitize 1996-11-04 17:59:28 +00:00
Jim Meyering f34578f297 . 1996-09-28 18:25:55 +00:00
Jim Meyering e8b07e3796 update FSF address in copyright 1996-07-15 03:36:16 +00:00
Jim Meyering 75b93231ca Remove my address. 1996-07-14 21:47:23 +00:00
Jim Meyering 1fffbc7472 No longer include safe-l?stat.h. 1995-05-19 15:23:18 +00:00
Jim Meyering c093a8e789 (make_path): Use stat, not SAFE_STAT.
Use strchr, not index.  Adjust defines accordingly.
1995-05-13 13:30:10 +00:00
Jim Meyering 4c722a96ba merge with 1.12 1994-11-06 17:51:23 +00:00
Jim Meyering 8edc08d48e Include makepath.h.
Add an argument: PRESERVE_EXISTING.
Declare char* arguments const.
1994-11-04 06:05:34 +00:00
Jim Meyering f1ce35a10c merge with 3.9h 1994-10-02 05:43:03 +00:00
Jim Meyering 52b4bf84e7 . 1994-08-27 21:34:13 +00:00
Jim Meyering fe4becacb4 . 1994-08-27 21:26:52 +00:00
Jim Meyering be7d4a230e Use SAFE_STAT instead of stat to avoid unnecessary failure
on systems for which stat can return EINTR.
1994-07-30 13:13:52 +00:00
Jim Meyering 363b712c93 . 1994-07-03 13:18:31 +00:00
Jim Meyering 7691d2fba0 merge with 3.8.4c 1993-10-12 20:24:09 +00:00
Jim Meyering 9cfcec5b05 merge with 3.8.4b 1993-10-12 04:30:50 +00:00
Jim Meyering f2080b7714 merge with 3.8.3b 1993-10-06 16:44:26 +00:00
Jim Meyering 061697058c merge with 3.8.3a 1993-10-06 00:24:18 +00:00
Jim Meyering 5ca6750d57 merge with 3.5.4 1993-05-13 01:14:47 +00:00
Jim Meyering 93dcd18946 merge with 3.5.1 1993-05-02 21:35:51 +00:00
Jim Meyering 7ff4e5a700 (make_path): Explicitly cast alloca return value to (char *). 1993-04-04 21:52:09 +00:00
Jim Meyering 80f8bd8e8c merge with 3.4.1 1993-03-29 05:09:09 +00:00
Jim Meyering 37ff29b820 Add parentheses to expressions like (c = *p++) as per suggestion
from gcc -Wall.
1992-10-31 23:00:47 +00:00
Jim Meyering 14fd34b788 Initial revision 1992-10-31 20:42:48 +00:00