[PATCH 2/3] setarch: add "exec" message to --verbose

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>

Also we don't need fflush() in non-verbose case.

Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
 sys-utils/setarch.c         | 7 +++++--
 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 b5e401c..cf29cf7 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 54208ac..0024930 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
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux