From 4767fc607e5fd38b2a9c8db2d876125aaa10e578 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 6 Oct 2006 20:44:31 +0000 Subject: 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. --- src/mkdir.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/mkdir.c') 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) -- cgit v1.2.3-54-g00ecf