[parted-devel] [PATCH 2/3] parted: Send a few errors and warnings to stderr instead of stdout.

Richard W.M. Jones rjones at redhat.com
Wed Oct 12 21:16:35 UTC 2011


From: "Richard W.M. Jones" <rjones at redhat.com>

---
 parted/parted.c  |    4 ++--
 parted/strlist.c |    4 ++--
 parted/ui.c      |    8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index bc14322..c9ae41f 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1926,8 +1926,8 @@ if (!opt_script_mode)
 
 #ifdef HAVE_GETUID
         if (getuid() != 0 && !opt_script_mode) {
-            puts (_("WARNING: You are not superuser.  Watch out for "
-                    "permissions."));
+            fputs (_("WARNING: You are not superuser.  Watch out for "
+                     "permissions.\n"), stderr);
         }
 #endif
 
diff --git a/parted/strlist.c b/parted/strlist.c
index 54ff8c8..46ef307 100644
--- a/parted/strlist.c
+++ b/parted/strlist.c
@@ -119,7 +119,7 @@ gettext_to_wchar (const char* str)
 	return result;
 
 error:
-	printf ("Error during translation: %s\n", strerror (errno));
+	fprintf (stderr, "Error during translation: %s\n", strerror (errno));
 	exit (EXIT_FAILURE);
 }
 
@@ -168,7 +168,7 @@ wchar_to_str (const wchar_t* str, size_t count)
 	return result;
 
 error:
-	printf ("Error during translation: %s\n", strerror (errno));
+	fprintf (stderr, "Error during translation: %s\n", strerror (errno));
 	exit (EXIT_FAILURE);
 }
 
diff --git a/parted/ui.c b/parted/ui.c
index 56c0304..77bb24c 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -340,7 +340,7 @@ sa_sigint_handler (int signum, siginfo_t* info, void *ucontext)
 static void
 sa_sigsegv_handler (int signum, siginfo_t* info, void* ucontext)
 {
-        printf (bug_msg, VERSION);
+        fprintf (stderr, bug_msg, VERSION);
         _dump_history ();
 
         if (!info)
@@ -375,7 +375,7 @@ sa_sigsegv_handler (int signum, siginfo_t* info, void* ucontext)
 static void
 sa_sigfpe_handler (int signum, siginfo_t* info, void* ucontext)
 {
-        printf (bug_msg, VERSION);
+        fprintf (stderr, bug_msg, VERSION);
         _dump_history ();
 
         if (!info)
@@ -439,7 +439,7 @@ sa_sigfpe_handler (int signum, siginfo_t* info, void* ucontext)
 static void
 sa_sigill_handler (int signum, siginfo_t* info, void* ucontext)
 {
-        printf (bug_msg, VERSION);
+        fprintf (stderr, bug_msg, VERSION);
         _dump_history ();
 
         if (!info)
@@ -617,7 +617,7 @@ _print_exception_text (PedException* ex)
         wipe_line ();
 
         if (ex->type == PED_EXCEPTION_BUG) {
-                printf (bug_msg, VERSION);
+                fprintf (stderr, bug_msg, VERSION);
                 text = str_list_create ("\n", ex->message, "\n\n", NULL);
         } else {
                 text = str_list_create (
-- 
1.7.6




More information about the parted-devel mailing list