diff options
author | Jim Meyering <jim@meyering.net> | 2000-12-02 13:20:37 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-12-02 13:20:37 +0000 |
commit | cc27b86c6046e0144b7a8491e51ca63463ac4633 (patch) | |
tree | 072013f54f255f3cc7798a9ffa6357e2ef335b92 /src | |
parent | 9db47bb80898764561c089c72b061b2ccfce3bf1 (diff) | |
download | coreutils-cc27b86c6046e0144b7a8491e51ca63463ac4633.tar.xz |
(main): Remove any trailing slash unconditionally.
Reported by Volker Borchert.
Diffstat (limited to 'src')
-rw-r--r-- | src/mkdir.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/mkdir.c b/src/mkdir.c index c9d03eddd..3a92cfc4f 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -143,23 +143,19 @@ main (int argc, char **argv) for (; optind < argc; ++optind) { int fail = 0; + + /* Remove any trailing slashes. Not removing them would lead to calling + `mkdir ("dir/", mode)' for e.g., the commands `mkdir dir/' and + `mkdir -p dir/', and such a call fails on NetBSD systems when `dir' + doesn't already exist. */ + strip_trailing_slashes (argv[optind]); + if (create_parents) { char *parents = dir_name (argv[optind]); fail = make_path (parents, parent_mode, parent_mode, -1, -1, 1, verbose_fmt_string); free (parents); - - /* If we're creating parent directories, then it's ok to remove - trailing slashes. In fact, *not* removing them would lead - to calling `mkdir ("dir/", mode)' for the command `mkdir -p dir/', - and such a call fails on NetBSD systems if `dir' doesn't already - exist. */ - /* An alternate approach would be to change make_path to interpret - an argument with a trailing slash as if it also had a trailing - `.'. In fact, that would be more consistent with POSIX, so - FIXME: some day. */ - strip_trailing_slashes (argv[optind]); } if (fail == 0) |