summaryrefslogtreecommitdiff
path: root/src/mkdir.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-10-06 20:44:31 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-10-06 20:44:31 +0000
commit4767fc607e5fd38b2a9c8db2d876125aaa10e578 (patch)
treeb4468e643bfee985d4a797ce142567f17dbfe7a5 /src/mkdir.c
parent0fc6edb71490b03c79dd03c903a4b72ce2a23d81 (diff)
downloadcoreutils-4767fc607e5fd38b2a9c8db2d876125aaa10e578.tar.xz
Fix bug reported today by Mike Frysinger: mkdir -pv is logging the
wrong file name in some cases. * src/install.c (struct install_options): New type. (install_file_in_file_parents, main): Use it instead of struct cp_options. (process_dir): Remember the full name. (announce_mkdir, make_ancestor): Use the full name in announcements. * src/mkdir.c (struct mkdir_options): Add full_name member. (make_ancestor): Use the full name in announcements. (process_dir): Remember the full name. * tests/mkdir/Makefile.am (TESTS): Add p-v. * tests/mkdir/p-v: New file, to test this bug.
Diffstat (limited to 'src/mkdir.c')
-rw-r--r--src/mkdir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mkdir.c b/src/mkdir.c
index b28a02ac0..f8a0625a2 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -79,6 +79,9 @@ Mandatory arguments to long options are mandatory for short options too.\n\
/* Options passed to subsidiary functions. */
struct mkdir_options
{
+ /* Full name of directory that we are making. */
+ char const *full_name;
+
/* Function to make an ancestor, or NULL if ancestors should not be
made. */
int (*make_ancestor_function) (char const *, void *);
@@ -117,7 +120,7 @@ make_ancestor (char const *dir, void *options)
if (r == 0)
{
r = ! (o->ancestor_mode & S_IRUSR);
- announce_mkdir (dir, options);
+ announce_mkdir (o->full_name, options);
}
return r;
}
@@ -126,7 +129,8 @@ make_ancestor (char const *dir, void *options)
static int
process_dir (char *dir, struct savewd *wd, void *options)
{
- struct mkdir_options const *o = options;
+ struct mkdir_options *o = options;
+ o->full_name = dir;
return (make_dir_parents (dir, wd, o->make_ancestor_function, options,
o->mode, announce_mkdir,
o->mode_bits, (uid_t) -1, (gid_t) -1, true)