lib/makepath.c


Log

Author Commit Date CI Message
Jim Meyering d5907e80 1999-05-06T02:10:34 (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'.
Jim Meyering 90182dd6 1999-05-05T03:05:11 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.
Jim Meyering 60cbbda7 1999-04-26T13:13:00 (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.
Jim Meyering a5b7dcf8 1999-01-02T05:27:32 Include locale.h and libintl.h, and define `_()'. Mark translatable strings.
Jim Meyering dd8aa603 1999-01-02T05:16:57 (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.
Jim Meyering bee64b87 1998-02-11T22:17:38 Add my comment from ChangeLog entry for gkm's change.
Jim Meyering c0a160df 1998-01-10T10:28:37 (make_path): Reformat 3 if-stmts to test `if (newly_created_dir)' only once. Suggestion from Andreas Schwab.
Jim Meyering 0078bf81 1998-01-10T10:22:30 (make_path): Put only newly created directories on the LEADING_DIRS list.
Jim Meyering 9af5c927 1998-01-02T23:15:39 (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.
Jim Meyering 14ffdc38 1997-12-28T10:38:15 (make_path) [!__STDC__]: Remove K&R-style definition.
Jim Meyering 207939fc 1997-10-06T13:07:14 (make_path): Print verbose message using fprintf, not error.
Jim Meyering eb6c86a0 1997-10-06T13:03:29 (make_path): Print message IFF the directory was just created and the format string is non-NULL.
Jim Meyering df91a5f7 1997-07-09T18:02:07 (make_path): Chdir to `/' before starting if necessary. Call save_cwd before while loop rather than from first iteration inside it.
Jim Meyering 5253e5dc 1997-07-09T14:00:27 Add comments.
Jim Meyering c897bea3 1997-07-01T11:50:39 (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.
Jim Meyering 0bd4eccc 1997-06-15T13:34:47 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.
Jim Meyering 974c1be5 1996-11-04T17:57:34 libitize
Jim Meyering 3d7fc7a8 1996-09-28T18:25:55 .
Jim Meyering 6d8337bf 1996-07-15T03:36:16 update FSF address in copyright
Jim Meyering 87796d9c 1996-07-14T21:47:23 Remove my address.
Jim Meyering 47a70ed9 1995-05-19T15:23:18 No longer include safe-l?stat.h.
Jim Meyering cd717695 1995-05-13T13:30:10 (make_path): Use stat, not SAFE_STAT. Use strchr, not index. Adjust defines accordingly.
Jim Meyering d6435a17 1994-11-06T17:51:31 merge with 1.12
Jim Meyering 32545ade 1994-11-04T06:05:34 Include makepath.h. Add an argument: PRESERVE_EXISTING. Declare char* arguments const.
Jim Meyering 300424a2 1994-10-02T05:43:03 merge with 3.9h
Jim Meyering d2577763 1994-08-27T21:34:13 .
Jim Meyering bea3493f 1994-08-27T21:23:07 .
Jim Meyering 68eb0d90 1994-07-30T13:13:52 Use SAFE_STAT instead of stat to avoid unnecessary failure on systems for which stat can return EINTR.
Jim Meyering 84c6de08 1994-07-03T13:18:31 .
Jim Meyering a89ae060 1993-10-12T20:24:09 merge with 3.8.4c
Jim Meyering f3589315 1993-10-12T04:31:02 merge with 3.8.4b
Jim Meyering 92a0e357 1993-10-06T16:44:42 merge with 3.8.3b
Jim Meyering de7ba135 1993-10-06T00:24:28 merge with 3.8.3a
Jim Meyering 26057be2 1993-05-13T01:14:58 merge with 3.5.4
Jim Meyering c265d0a1 1993-05-02T21:36:04 merge with 3.5.1
Jim Meyering d7b5315b 1993-04-04T21:52:09 (make_path): Explicitly cast alloca return value to (char *).
Jim Meyering b0657895 1993-03-29T05:09:24 merge with 3.4.1
Jim Meyering 26e411da 1992-10-31T23:00:47 Add parentheses to expressions like (c = *p++) as per suggestion from gcc -Wall.
Jim Meyering d87c3946 1992-10-31T20:42:48 Initial revision