dbus/dbus dbus-sysdeps-util.c,1.1,1.2 dbus-sysdeps.c,1.91,1.92

Havoc Pennington hp at freedesktop.org
Sat Mar 5 10:38:56 PST 2005


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv30432/dbus

Modified Files:
	dbus-sysdeps-util.c dbus-sysdeps.c 
Log Message:
2005-03-05  Havoc Pennington  <hp at redhat.com>

	* dbus/dbus-sysdeps.c:
	(pseudorandom_generate_random_bytes_buffer): fix to have no return
	value
	(_dbus_generate_random_bytes_buffer): fix return value

	* dbus/dbus-sysdeps-util.c: s/GETPWNAME/GETPWNAM/ so configure
	checks actually work, from Tom Parker <fdo at tevp.net>



Index: dbus-sysdeps-util.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-util.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dbus-sysdeps-util.c	17 Jan 2005 03:53:40 -0000	1.1
+++ dbus-sysdeps-util.c	5 Mar 2005 18:38:54 -0000	1.2
@@ -590,7 +590,7 @@
    * to add more configure checks.
    */
   
-#if defined (HAVE_POSIX_GETPWNAME_R) || defined (HAVE_NONPOSIX_GETPWNAME_R)
+#if defined (HAVE_POSIX_GETPWNAM_R) || defined (HAVE_NONPOSIX_GETPWNAM_R)
   {
     struct group *g;
     int result;
@@ -598,7 +598,7 @@
     struct group g_str;
 
     g = NULL;
-#ifdef HAVE_POSIX_GETPWNAME_R
+#ifdef HAVE_POSIX_GETPWNAM_R
 
     if (group_c_str)
       result = getgrnam_r (group_c_str, &g_str, buf, sizeof (buf),
@@ -609,7 +609,7 @@
 #else
     p = getgrnam_r (group_c_str, &g_str, buf, sizeof (buf));
     result = 0;
-#endif /* !HAVE_POSIX_GETPWNAME_R */
+#endif /* !HAVE_POSIX_GETPWNAM_R */
     if (result == 0 && g == &g_str)
       {
         return fill_user_info_from_group (g, info, error);

Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- dbus-sysdeps.c	25 Feb 2005 22:03:30 -0000	1.91
+++ dbus-sysdeps.c	5 Mar 2005 18:38:54 -0000	1.92
@@ -1434,7 +1434,7 @@
    * checks
    */
   
-#if defined (HAVE_POSIX_GETPWNAME_R) || defined (HAVE_NONPOSIX_GETPWNAME_R)
+#if defined (HAVE_POSIX_GETPWNAM_R) || defined (HAVE_NONPOSIX_GETPWNAM_R)
   {
     struct passwd *p;
     int result;
@@ -1442,8 +1442,8 @@
     struct passwd p_str;
 
     p = NULL;
-#ifdef HAVE_POSIX_GETPWNAME_R
-    if (uid >= 0)
+#ifdef HAVE_POSIX_GETPWNAM_R
+    if (uid != DBUS_UID_UNSET)
       result = getpwuid_r (uid, &p_str, buf, sizeof (buf),
                            &p);
     else
@@ -1455,7 +1455,7 @@
     else
       p = getpwnam_r (username_c, &p_str, buf, sizeof (buf));
     result = 0;
-#endif /* !HAVE_POSIX_GETPWNAME_R */
+#endif /* !HAVE_POSIX_GETPWNAM_R */
     if (result == 0 && p == &p_str)
       {
         if (!fill_user_info_from_passwd (p, info, error))
@@ -2327,7 +2327,7 @@
                             _dbus_string_get_length (dir));
 }
 
-static dbus_bool_t
+static void
 pseudorandom_generate_random_bytes_buffer (char *buffer,
                                            int   n_bytes)
 {
@@ -2388,12 +2388,16 @@
   DBusString str;
 
   if (!_dbus_string_init (&str))
-    return pseudorandom_generate_random_bytes_buffer (buffer, n_bytes);
+    {
+      pseudorandom_generate_random_bytes_buffer (buffer, n_bytes);
+      return;
+    }
 
   if (!_dbus_generate_random_bytes (&str, n_bytes))
     {
       _dbus_string_free (&str);
-      return pseudorandom_generate_random_bytes_buffer (buffer, n_bytes);
+      pseudorandom_generate_random_bytes_buffer (buffer, n_bytes);
+      return;
     }
 
   _dbus_string_copy_to_buffer (&str, buffer, n_bytes);



More information about the dbus-commit mailing list