[parted-devel] [PATCH] Suppress "you are not superuser..." warning in script mode.

Jim Meyering jim at meyering.net
Mon May 7 14:49:46 UTC 2007


This isn't a big deal, but I found it very useful in adjusting
my integration testing framework (big patch coming in a few minutes).
Without it, I have to test whether running with uid=0 to determine what
the expected output should be, even with --script.  With this change,
at least when testing with --script, the output is the same (no warning)
for root and non-root.

This patch does break the existing integration tests, but the
next patch (that replaces the framework and rewrites integration tests)
puts everything back in order.

	Suppress "you are not superuser..." warning in script mode.
	* parted/parted.c (_init): Do not emit this warning in script mode:
	"You are not superuser.  Watch out for permissions."

Signed-off-by: Jim Meyering <jim at meyering.net>
---
 parted/parted.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index 3c4aedd..385974d 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2407,7 +2407,7 @@ if (!_parse_options (argc_ptr, argv_ptr))
         goto error_done_commands;

 #ifdef HAVE_GETUID
-        if (getuid() != 0) {
+        if (getuid() != 0 && !opt_script_mode) {
             puts (_("WARNING: You are not superuser.  Watch out for "
                     "permissions."));
         }



More information about the parted-devel mailing list