(main): When make_dir_parents changes the current working

directory, give a diagnostic about each subsequent failure to create
a dot-relative directory.
(install_file_in_file_parents): Update make_dir_parents caller.
This commit is contained in:
Jim Meyering
2005-06-13 10:19:18 +00:00
parent 4063f9696c
commit 736dfd391d
+19 -2
View File
@@ -357,11 +357,25 @@ main (int argc, char **argv)
if (dir_arg)
{
int i;
bool cwd_not_restored = false;
for (i = 0; i < n_files; i++)
{
bool different_cwd;
if (cwd_not_restored && IS_RELATIVE_FILE_NAME (argv[optind]))
{
error (0, 0,
_("unable to create relative-named directory, %s,"
" due to prior failure to restore working directory"),
quote (argv[optind]));
ok = false;;
continue;
}
ok &=
make_dir_parents (file[i], mode, mode, owner_id, group_id, false,
(x.verbose ? _("creating directory %s") : NULL));
(x.verbose ? _("creating directory %s") : NULL),
&different_cwd);
cwd_not_restored |= different_cwd;
}
}
else
@@ -409,9 +423,12 @@ install_file_in_file_parents (char const *from, char const *to,
that this option is intended mainly to help installers when the
distribution doesn't provide proper install rules. */
mode_t dir_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
bool different_cwd; /* FIXME: use this */
ok = make_dir_parents (dest_dir, dir_mode, dir_mode,
owner_id, group_id, true,
(x->verbose ? _("creating directory %s") : NULL));
(x->verbose ? _("creating directory %s") : NULL),
&different_cwd);
/* Ignore different_cwd, since this function is called at most once. */
}
free (dest_dir);