diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-11-01 18:53:26 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-11-04 23:30:14 +0000 |
commit | 08e8fd7e38f2dae7c69c54eb22d508b6517e66e5 (patch) | |
tree | 63d021e305cd93bea445f9484fe8b3446dda2c3d /src/chroot.c | |
parent | 1e8f9afac53a628dbc64e62bea53eb2da29c47fa (diff) | |
download | coreutils-08e8fd7e38f2dae7c69c54eb22d508b6517e66e5.tar.gz |
all: avoid quoting file names when possible
Quote file names using the "shell-escape" or "shell-escape-always"
methods, which quote as appropriate for most shells,
and better support copy and paste of presented names.
The "always" variant is used when the file name is
embedded in an error message with surrounding spaces.
* cfg.mk (sc_error_shell_quotes): A new syntax check rule
to suggest quotef() where appropriate.
(sc_error_shell_always_quotes): Likewise for quoteaf().
* src/system.h (quotef): A new define to apply shell quoting
when needed. I.E. when shell character or ':' is present.
(quoteaf): Likewise, but always quote.
* src/*.c: Use quotef() and quoteaf() rather than quote()
where appropriate.
* tests/: Adjust accordingly.
Diffstat (limited to 'src/chroot.c')
-rw-r--r-- | src/chroot.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/chroot.c b/src/chroot.c index 9551d934f..ec2f5c444 100644 --- a/src/chroot.c +++ b/src/chroot.c @@ -200,7 +200,7 @@ Run COMMAND with root directory set to NEWROOT.\n\ "), stdout); printf (_("\ --skip-chdir do not change working directory to %s\n\ -"), quote ("/")); +"), quoteaf ("/")); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); @@ -284,7 +284,7 @@ main (int argc, char **argv) if (! is_oldroot && skip_chdir) { error (0, 0, _("option --skip-chdir only permitted if NEWROOT is old %s"), - quote ("/")); + quoteaf ("/")); usage (EXIT_CANCELED); } @@ -327,7 +327,7 @@ main (int argc, char **argv) if (chroot (newroot) != 0) error (EXIT_CANCELED, errno, _("cannot change root directory to %s"), - quote (newroot)); + quoteaf (newroot)); if (! skip_chdir && chdir ("/")) error (EXIT_CANCELED, errno, _("cannot chdir to root directory")); |