rpms/control-center/devel 0001-Remove-old-code-poking-directly-into-the-pwent.patch, NONE, 1.1 control-center.spec, 1.468, 1.469 gnome-control-center-2.25.2-passwd.patch, 1.3, 1.4

Bastien Nocera hadess at fedoraproject.org
Fri Aug 14 16:52:59 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/control-center/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23512

Modified Files:
	control-center.spec gnome-control-center-2.25.2-passwd.patch 
Added Files:
	0001-Remove-old-code-poking-directly-into-the-pwent.patch 
Log Message:
* Fri Aug 14 2009 Bastien Nocera <bnocera at redhat.com> 2.27.5-1
- Split off passwd usage patch


0001-Remove-old-code-poking-directly-into-the-pwent.patch:
 gnome-about-me.c |   59 +++++--------------------------------------------------
 1 file changed, 6 insertions(+), 53 deletions(-)

--- NEW FILE 0001-Remove-old-code-poking-directly-into-the-pwent.patch ---
>From d5c5c8d58fe997e8af0675cdaf0e025e21edfa19 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen at redhat.com>
Date: Fri, 14 Aug 2009 17:44:17 +0100
Subject: [PATCH] Remove old code poking directly into the pwent

Use the glib functions to get the login name and real user name,
instead or some crummy Unix-y code.
---
 capplets/about-me/gnome-about-me.c |   58 ++++--------------------------------
 1 files changed, 6 insertions(+), 52 deletions(-)

diff --git a/capplets/about-me/gnome-about-me.c b/capplets/about-me/gnome-about-me.c
index 5a40874..af5c579 100644
--- a/capplets/about-me/gnome-about-me.c
+++ b/capplets/about-me/gnome-about-me.c
@@ -24,10 +24,8 @@
 #endif
 
 #include <glib/gstdio.h>
-#include <pwd.h>
 #include <gio/gio.h>
 #include <gconf/gconf-client.h>
-#include <pwd.h>
 #include <unistd.h>
 #include <libebook/e-book.h>
 #include <dbus/dbus-glib-bindings.h>
@@ -332,22 +330,6 @@ about_me_focus_out (GtkWidget *widget, GdkEventFocus *event, GnomeAboutMe *me)
 	return FALSE;
 }
 
-static char *
-get_user_login (void)
-{
-	char buf[LINE_MAX * 4];
-	struct passwd pwd, *err;
-
-	int i;
-#if defined(__sun) && !defined(_POSIX_PTHREAD_SEMANTICS)
-	i = getpwuid_r (getuid (), &pwd, buf, sizeof (buf));
-	return (i != 0) ? g_strdup (pwd.pw_name) : NULL;
-#else
-	i = getpwuid_r (getuid (), &pwd, buf, sizeof (buf), &err);
-	return ((i == 0) && (err == &pwd)) ? g_strdup (pwd.pw_name) : NULL;
-#endif
-}
-
 /*
  * Helpers
  */
@@ -858,16 +840,13 @@ about_me_setup_dialog (void)
 	GtkBuilder   *dialog;
 	GError 	     *error = NULL;
 	GList        *chain;
-
-	struct passwd *pwent;
-	gchar *str;
-	gchar **tok;
+	gchar        *str;
 
 	me = g_new0 (GnomeAboutMe, 1);
 
 	dialog = gtk_builder_new ();
 	gtk_builder_add_from_file (dialog, GNOMECC_UI_DIR "/gnome-about-me-dialog.ui", NULL);
-    
+
 	me->image_chooser = e_image_chooser_new ();
 	gtk_container_add (GTK_CONTAINER (WID ("button-image")), me->image_chooser);
 
@@ -933,34 +912,14 @@ about_me_setup_dialog (void)
 		about_me_setup_email (me);
 	}
 
-	/************************************************/
-	me->login = get_user_login ();
-	setpwent ();
-	pwent = getpwnam (me->login);
-	if (pwent == NULL) {
-		about_me_error (GTK_WINDOW (WID ("about-me-dialog")),
-				_("Unknown login ID, the user database might be corrupted"));
-		about_me_destroy (me);
-		return -1;
-	}
-	tok = g_strsplit (pwent->pw_gecos, ",", 0);
-
-	/************************************************/
-
-	if (tok[0] == NULL || *tok[0] == '\0')
-		me->username = NULL;
-	else
-		me->username = g_strdup (tok[0]);
+	me->login = g_strdup (g_get_user_name ());
+	me->username = g_strdup (g_get_real_name ());
 
 	/* Contact Tab */
 	about_me_load_photo (me, me->contact);
 
 	widget = WID ("fullname");
-	if (tok[0] == NULL || *tok[0] == '\0') {
-		str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", me->login);
-	} else {
-		str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", tok[0]);
-	}
+	str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", me->username);
 
 	gtk_label_set_markup (GTK_LABEL (widget), str);
 	g_free (str);
@@ -968,14 +927,9 @@ about_me_setup_dialog (void)
 	widget = WID ("login");
 	gtk_label_set_text (GTK_LABEL (widget), me->login);
 
-	if (tok[0] == NULL || *tok[0] == '\0') {
-		str = g_strdup_printf (_("About %s"), me->login);
-	} else {
-		str = g_strdup_printf (_("About %s"), tok[0]);
-	}
+	str = g_strdup_printf (_("About %s"), me->username);
 	gtk_window_set_title (GTK_WINDOW (main_dialog), str);
 	g_free (str);
-	g_strfreev (tok);
 
 	widget = WID ("password");
 	g_signal_connect (widget, "clicked",
-- 
1.6.2.5



Index: control-center.spec
===================================================================
RCS file: /cvs/pkgs/rpms/control-center/devel/control-center.spec,v
retrieving revision 1.468
retrieving revision 1.469
diff -u -p -r1.468 -r1.469
--- control-center.spec	14 Aug 2009 13:44:37 -0000	1.468
+++ control-center.spec	14 Aug 2009 16:52:59 -0000	1.469
@@ -34,6 +34,8 @@ Source1: org.gnome.control-center.defaul
 Patch3: control-center-2.19.3-no-gnome-common.patch
 # http://bugzilla.gnome.org/536531
 Patch7: make-default.patch
+# http://bugzilla.gnome.org/show_bug.cgi?id=591824
+Patch8: 0001-Remove-old-code-poking-directly-into-the-pwent.patch
 
 # https://bugzilla.redhat.com/show_bug.cgi?id=475804
 Patch10: gcc-pam-fprintd-avail.patch
@@ -361,6 +363,9 @@ fi
 
 %changelog
 * Fri Aug 14 2009 Bastien Nocera <bnocera at redhat.com> 2.27.5-1
+- Split off passwd usage patch
+
+* Fri Aug 14 2009 Bastien Nocera <bnocera at redhat.com> 2.27.5-1
 - Update to 2.27.5
 - Port PolicyKit patches to latest version
 - Disable gecos patch, needs porting to GtkBuilder

gnome-control-center-2.25.2-passwd.patch:
 gnome-about-me.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Index: gnome-control-center-2.25.2-passwd.patch
===================================================================
RCS file: /cvs/pkgs/rpms/control-center/devel/gnome-control-center-2.25.2-passwd.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- gnome-control-center-2.25.2-passwd.patch	10 Aug 2009 16:14:29 -0000	1.3
+++ gnome-control-center-2.25.2-passwd.patch	14 Aug 2009 16:52:59 -0000	1.4
@@ -22,69 +22,3 @@ index 8119c3c..b7fe5d8 100644
  }
  
  static void
-@@ -884,10 +880,7 @@ about_me_setup_dialog (void)
- 	GtkBuilder   *dialog;
- 	GError 	     *error = NULL;
- 	GList        *chain;
--
--	struct passwd *pwent;
--	gchar *str;
--	gchar **tok;
-+	gchar        *str;
- 
- 	me = g_new0 (GnomeAboutMe, 1);
- 
-@@ -959,34 +952,14 @@ about_me_setup_dialog (void)
- 		about_me_setup_email (me);
- 	}
- 
--	/************************************************/
--	me->login = get_user_login ();
--	setpwent ();
--	pwent = getpwnam (me->login);
--	if (pwent == NULL) {
--		about_me_error (GTK_WINDOW (WID ("about-me-dialog")),
--				_("Unknown login ID, the user database might be corrupted"));
--		about_me_destroy (me);
--		return -1;
--	}
--	tok = g_strsplit (pwent->pw_gecos, ",", 0);
--
--	/************************************************/
--
--	if (tok[0] == NULL || *tok[0] == '\0')
--		me->username = NULL;
--	else
--		me->username = g_strdup (tok[0]);
-+	me->login = g_strdup (g_get_user_name ());
-+	me->username = g_strdup (g_get_real_name ());
- 
- 	/* Contact Tab */
- 	about_me_load_photo (me, me->contact);
- 
- 	widget = WID ("fullname");
--	if (tok[0] == NULL || *tok[0] == '\0') {
--		str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", me->login);
--	} else {
--		str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", tok[0]);
--	}
-+	str = g_strdup_printf ("<b><span size=\"xx-large\">%s</span></b>", me->username);
- 
- 	gtk_label_set_markup (GTK_LABEL (widget), str);
- 	g_free (str);
-@@ -994,14 +967,9 @@ about_me_setup_dialog (void)
- 	widget = WID ("login");
- 	gtk_label_set_text (GTK_LABEL (widget), me->login);
- 
--	if (tok[0] == NULL || *tok[0] == '\0') {
--		str = g_strdup_printf (_("About %s"), me->login);
--	} else {
--		str = g_strdup_printf (_("About %s"), tok[0]);
--	}
-+	str = g_strdup_printf (_("About %s"), me->username);
- 	gtk_window_set_title (GTK_WINDOW (main_dialog), str);
- 	g_free (str);
--	g_strfreev (tok);
- 
- 	widget = WID ("password");
- 	g_signal_connect (widget, "clicked",




More information about the fedora-extras-commits mailing list