* Does the chdir, fork, setsid, etc. to become a daemon process.
*
* @param pidfile #NULL, or pidfile to create
- * @param print_pid_fd file descriptor to print pid to, or -1 for none
+ * @param print_pid_fd file descriptor to print daemon's pid to, or -1 for none
* @param error return location for errors
* @returns #FALSE on failure
*/
return FALSE;
}
- if (!_dbus_string_append_int (&pid, _dbus_getpid ()) ||
+ if (!_dbus_string_append_int (&pid, child_pid) ||
!_dbus_string_append (&pid, "\n"))
{
_dbus_string_free (&pid);
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to write to \"%s\": %s", cfilename,
_dbus_strerror (errno));
+
+ fclose (f);
return FALSE;
}
act.sa_handler = handler;
act.sa_mask = empty_mask;
act.sa_flags = 0;
- sigaction (sig, &act, 0);
+ sigaction (sig, &act, NULL);
}
return FALSE;
}
- if (!_dbus_string_append (&f, DBUS_CONSOLE_DIR))
+ if (!_dbus_string_append (&f, DBUS_CONSOLE_AUTH_DIR))
{
_DBUS_SET_OOM (error);
goto out;
* 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;
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),
result = getgrgid_r (gid, &g_str, buf, sizeof (buf),
&g);
#else
- p = getgrnam_r (group_c_str, &g_str, buf, sizeof (buf));
+ g = 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);
return fill_group_info (info, gid, NULL, error);
}
-/**
- * Frees the members of info (but not info itself).
- *
- * @param info the group info
- */
-void
-_dbus_group_info_free (DBusGroupInfo *info)
-{
- dbus_free (info->groupname);
-}
-
/** @} */ /* End of DBusInternalsUtils functions */
/**