X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-sysdeps-util-unix.c;h=6cff3fe20de4443d2c110e98e0875e82104516cb;hb=00c1c0ac1fb9258747c56ff77a4a35beb44bd994;hp=a80f6430ca55a7df9703fb335511466c2368ff64;hpb=e7677fc83cbec9da1479b499f565a73897cd2240;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index a80f643..6cff3fe 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -123,6 +123,7 @@ _dbus_become_daemon (const DBusString *pidfile, dup2 (dev_null_fd, 2); else _dbus_verbose ("keeping stderr open due to DBUS_DEBUG_OUTPUT\n"); + close (dev_null_fd); } if (!keep_umask) @@ -254,8 +255,8 @@ _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile, DBusString pid; int bytes; - _dbus_verbose ("writing our pid to pipe %"PRIuPTR"\n", - print_pid_pipe->fd_or_handle); + _dbus_verbose ("writing our pid to pipe %d\n", + print_pid_pipe->fd); if (!_dbus_string_init (&pid)) { @@ -389,7 +390,6 @@ _dbus_request_file_descriptor_limit (unsigned int limit) #ifdef HAVE_SETRLIMIT struct rlimit lim; struct rlimit target_lim; - unsigned int current_limit; /* No point to doing this practically speaking * if we're not uid 0. We expect the system @@ -422,11 +422,16 @@ _dbus_request_file_descriptor_limit (unsigned int limit) #endif } -void +void _dbus_init_system_log (void) { +#if HAVE_DECL_LOG_PERROR openlog ("dbus", LOG_PID | LOG_PERROR, LOG_DAEMON); +#else + openlog ("dbus", LOG_PID, LOG_DAEMON); +#endif } + /** * Log a message to the system log file (e.g. syslog on Unix). * @@ -476,6 +481,19 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args return; } +#ifndef HAVE_DECL_LOG_PERROR + { + /* vsyslog() won't write to stderr, so we'd better do it */ + va_list tmp; + + DBUS_VA_COPY (tmp, args); + fprintf (stderr, "dbus[" DBUS_PID_FORMAT "]: ", _dbus_getpid ()); + vfprintf (stderr, msg, tmp); + fputc ('\n', stderr); + va_end (tmp); + } +#endif + vsyslog (flags, msg, args); if (severity == DBUS_SYSTEM_LOG_FATAL) @@ -523,7 +541,7 @@ _dbus_user_at_console (const char *username, DBusError *error) { - DBusString f; + DBusString u, f; dbus_bool_t result; result = FALSE; @@ -539,8 +557,9 @@ _dbus_user_at_console (const char *username, goto out; } + _dbus_string_init_const (&u, username); - if (!_dbus_string_append (&f, username)) + if (!_dbus_concat_dir_and_file (&f, &u)) { _DBUS_SET_OOM (error); goto out;