[vino] Return values other than zero if the program fails.



commit dd1fabd58d0532247d32e6ac0e83f12b8e10e92e
Author: Jonh Wendell <jwendell gnome org>
Date:   Wed Aug 12 14:57:27 2009 -0300

    Return values other than zero if the program fails.

 tools/vino-passwd.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/tools/vino-passwd.c b/tools/vino-passwd.c
index fe6b1b3..c5a8801 100644
--- a/tools/vino-passwd.c
+++ b/tools/vino-passwd.c
@@ -147,7 +147,7 @@ vino_passwd_read (char *buff,
   fflush (stdout);
 }
 
-static void
+static int
 vino_passwd_change (GConfClient *conf)
 {
   gchar password1[VINO_PASSWORD_MAXLEN + 1];
@@ -165,11 +165,13 @@ vino_passwd_change (GConfClient *conf)
     {
       vino_passwd_set_password (conf, password1);
       g_print (_("vino-passwd: password updated successfully.\n"));
+      return 0;
     }
   else
     {
       g_printerr (_("Sorry, passwords do not match.\n"));
       g_printerr (_("vino-passwd: password unchanged.\n"));
+      return 1;
     }
 }
 
@@ -230,11 +232,10 @@ main(int argc, char *argv[])
   conf = gconf_client_get_default ();
 
   if (gconf_client_key_is_writable (conf, VINO_PREFS_VNC_PASSWORD, NULL))
-    vino_passwd_change (conf);
+    return vino_passwd_change (conf);
   else
-    g_printerr (_("ERROR: You do not have enough permissions to change Vino password.\n"));
-
-  g_object_unref (conf);
-
-  return 0;
+    {
+      g_printerr (_("ERROR: You do not have enough permissions to change Vino password.\n"));
+      return 1;
+    }
 }



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