"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dbus/dbus-sysdeps-util-unix.c" between
dbus-1.13.12.tar.xz and dbus-1.13.14.tar.xz

About: D-Bus is an inter-process communication (IPC) system, allowing multiple, concurrently-running applications to communicate with one another. D-Bus supplies both a system daemon and a per-user-login-session daemon. Development version.

dbus-sysdeps-util-unix.c  (dbus-1.13.12.tar.xz):dbus-sysdeps-util-unix.c  (dbus-1.13.14.tar.xz)
skipping to change at line 822 skipping to change at line 822
if (groupname) if (groupname)
group_c_str = _dbus_string_get_const_data (groupname); group_c_str = _dbus_string_get_const_data (groupname);
else else
group_c_str = NULL; group_c_str = NULL;
/* For now assuming that the getgrnam() and getgrgid() flavors /* For now assuming that the getgrnam() and getgrgid() flavors
* always correspond to the pwnam flavors, if not we have * always correspond to the pwnam flavors, if not we have
* to add more configure checks. * to add more configure checks.
*/ */
#if defined (HAVE_POSIX_GETPWNAM_R) || defined (HAVE_NONPOSIX_GETPWNAM_R) #ifdef HAVE_GETPWNAM_R
{ {
struct group *g; struct group *g;
int result; int result;
size_t buflen; size_t buflen;
char *buf; char *buf;
struct group g_str; struct group g_str;
dbus_bool_t b; dbus_bool_t b;
/* retrieve maximum needed size for buf */ /* retrieve maximum needed size for buf */
buflen = sysconf (_SC_GETGR_R_SIZE_MAX); buflen = sysconf (_SC_GETGR_R_SIZE_MAX);
skipping to change at line 852 skipping to change at line 852
while (1) while (1)
{ {
buf = dbus_malloc (buflen); buf = dbus_malloc (buflen);
if (buf == NULL) if (buf == NULL)
{ {
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
return FALSE; return FALSE;
} }
g = NULL; g = NULL;
#ifdef HAVE_POSIX_GETPWNAM_R
if (group_c_str) if (group_c_str)
result = getgrnam_r (group_c_str, &g_str, buf, buflen, result = getgrnam_r (group_c_str, &g_str, buf, buflen,
&g); &g);
else else
result = getgrgid_r (gid, &g_str, buf, buflen, result = getgrgid_r (gid, &g_str, buf, buflen,
&g); &g);
#else
g = getgrnam_r (group_c_str, &g_str, buf, buflen);
result = 0;
#endif /* !HAVE_POSIX_GETPWNAM_R */
/* Try a bigger buffer if ERANGE was returned: /* Try a bigger buffer if ERANGE was returned:
https://bugs.freedesktop.org/show_bug.cgi?id=16727 https://bugs.freedesktop.org/show_bug.cgi?id=16727
*/ */
if (result == ERANGE && buflen < 512 * 1024) if (result == ERANGE && buflen < 512 * 1024)
{ {
dbus_free (buf); dbus_free (buf);
buflen *= 2; buflen *= 2;
} }
else else
{ {
skipping to change at line 897 skipping to change at line 892
group_c_str ? group_c_str : "???"); group_c_str ? group_c_str : "???");
dbus_free (buf); dbus_free (buf);
return FALSE; return FALSE;
} }
} }
#else /* ! HAVE_GETPWNAM_R */ #else /* ! HAVE_GETPWNAM_R */
{ {
/* I guess we're screwed on thread safety here */ /* I guess we're screwed on thread safety here */
struct group *g; struct group *g;
#warning getpwnam_r() not available, please report this to the dbus maintainers
with details of your OS
g = getgrnam (group_c_str); g = getgrnam (group_c_str);
if (g != NULL) if (g != NULL)
{ {
return fill_user_info_from_group (g, info, error); return fill_user_info_from_group (g, info, error);
} }
else else
{ {
dbus_set_error (error, _dbus_error_from_errno (errno), dbus_set_error (error, _dbus_error_from_errno (errno),
"Group %s unknown or failed to look it up\n", "Group %s unknown or failed to look it up\n",
 End of changes. 4 change blocks. 
6 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)