diff options
author | Ruediger Meier <ruediger.meier@ga-group.nl> | 2016-03-22 12:14:45 +0100 |
---|---|---|
committer | Ruediger Meier <ruediger.meier@ga-group.nl> | 2016-03-22 14:13:33 +0100 |
commit | 9508e2972b1fdfca81e95ad7c2310991695009b5 (patch) | |
tree | 4b67f11873f3226ac3e6243f28f3cc7c5255676e | |
parent | 8eefcbb8f53c03bc595bcc66767858f4d5c68cbe (diff) | |
download | util-linux-9508e2972b1fdfca81e95ad7c2310991695009b5.tar.gz |
setarch: add "exec" message to --verbose
Also we don't need fflush() in non-verbose case.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
-rw-r--r-- | sys-utils/setarch.c | 7 | ||||
-rw-r--r-- | tests/expected/misc/setarch | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index b5e401c81..cf29cf770 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -391,8 +391,11 @@ int main(int argc, char *argv[]) if (set_arch(arch, options, 0)) err(EXIT_FAILURE, _("failed to set personality to %s"), arch); - /* flush all output streams before exec */ - fflush(NULL); + if (verbose) { + printf(_("Execute command `%s'.\n"), argc ? argv[0] : "/bin/sh"); + /* flush all output streams before exec */ + fflush(NULL); + } if (!argc) { execl("/bin/sh", "-sh", NULL); diff --git a/tests/expected/misc/setarch b/tests/expected/misc/setarch index 54208acf6..002493030 100644 --- a/tests/expected/misc/setarch +++ b/tests/expected/misc/setarch @@ -9,4 +9,5 @@ Switching on WHOLE_SECONDS. Switching on STICKY_TIMEOUTS. Switching on ADDR_LIMIT_3GB. Switching on UNAME26. +Execute command `echo'. success |