dbus-common.c   dbus-common.c 
skipping to change at line 35 skipping to change at line 35
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <dbus/dbus.h> #include <dbus/dbus.h>
#include <string.h> #include <string.h>
#include <sys/epoll.h> #include <sys/epoll.h>
#include "log.h" #include "log.h"
#include "dbus-common.h" #include "dbus-common.h"
#include "util.h" #include "util.h"
#include "missing.h"
#include "def.h" #include "def.h"
#include "strv.h" #include "strv.h"
int bus_check_peercred(DBusConnection *c) { int bus_check_peercred(DBusConnection *c) {
int fd; int fd;
struct ucred ucred; struct ucred ucred;
socklen_t l; socklen_t l;
assert(c); assert(c);
skipping to change at line 124 skipping to change at line 125
return -EIO; return -EIO;
} else { } else {
if (t == DBUS_BUS_SESSION) { if (t == DBUS_BUS_SESSION) {
const char *e; const char *e;
/* If we are supposed to talk to the instance, /* If we are supposed to talk to the instance,
* try via XDG_RUNTIME_DIR first, then * try via XDG_RUNTIME_DIR first, then
* fallback to normal bus access */ * fallback to normal bus access */
e = getenv("XDG_RUNTIME_DIR"); e = secure_getenv("XDG_RUNTIME_DIR");
if (e) { if (e) {
char *p; char *p;
if (asprintf(&p, "unix:path=%s/systemd/priv ate", e) < 0) if (asprintf(&p, "unix:path=%s/systemd/priv ate", e) < 0)
return -ENOMEM; return -ENOMEM;
bus = dbus_connection_open_private(p, NULL) ; bus = dbus_connection_open_private(p, NULL) ;
free(p); free(p);
} }
} }
skipping to change at line 1255 skipping to change at line 1256
if (dbus_error_has_name(error, DBUS_ERROR_NAME_HAS_NO_OWNER)) if (dbus_error_has_name(error, DBUS_ERROR_NAME_HAS_NO_OWNER))
return true; return true;
if (dbus_error_has_name(error, DBUS_ERROR_SERVICE_UNKNOWN)) if (dbus_error_has_name(error, DBUS_ERROR_SERVICE_UNKNOWN))
return true; return true;
return startswith(error->name, "org.freedesktop.DBus.Error.Spawn.") ; return startswith(error->name, "org.freedesktop.DBus.Error.Spawn.") ;
} }
int bus_method_call_with_reply(DBusConnection *bus, int bus_method_call_with_reply(
const char *destination, DBusConnection *bus,
const char *path, const char *destination,
const char *interface, const char *path,
const char *method, const char *interface,
DBusMessage **return_reply, const char *method,
DBusError *return_error, DBusMessage **return_reply,
int first_arg_type, ...) { DBusError *return_error,
int first_arg_type, ...) {
DBusError error; DBusError error;
DBusMessage *m, *reply; DBusMessage *m, *reply;
va_list ap; va_list ap;
int r = 0; int r = 0;
dbus_error_init(&error); dbus_error_init(&error);
assert(bus); assert(bus);
m = dbus_message_new_method_call(destination, path, interface, meth od); m = dbus_message_new_method_call(destination, path, interface, meth od);
if (!m) { if (!m) {
r = log_oom(); r = log_oom();
goto finish; goto finish;
} }
va_start(ap, first_arg_type); va_start(ap, first_arg_type);
if (!dbus_message_append_args_valist(m, first_arg_type, ap)) { if (!dbus_message_append_args_valist(m, first_arg_type, ap)) {
va_end(ap); va_end(ap);
dbus_message_unref(m);
r = log_oom(); r = log_oom();
goto finish; goto finish;
} }
va_end(ap); va_end(ap);
reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &erro r); reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &erro r);
dbus_message_unref(m);
if (!reply) { if (!reply) {
if (!return_error) if (!return_error)
log_error("Failed to issue method call: %s", bus_er ror_message(&error)); log_error("Failed to issue method call: %s", bus_er ror_message(&error));
if (bus_error_is_no_service(&error)) if (bus_error_is_no_service(&error))
r = -ENOENT; r = -ENOENT;
else if (dbus_error_has_name(&error, DBUS_ERROR_ACCESS_DENI ED)) else if (dbus_error_has_name(&error, DBUS_ERROR_ACCESS_DENI ED))
r = -EACCES; r = -EACCES;
else if (dbus_error_has_name(&error, DBUS_ERROR_NO_REPLY)) else if (dbus_error_has_name(&error, DBUS_ERROR_NO_REPLY))
r = -ETIMEDOUT; r = -ETIMEDOUT;
else else
r = -EIO; r = -EIO;
goto finish; goto finish;
} }
if (return_reply) if (return_reply)
*return_reply = reply; *return_reply = reply;
else else
dbus_message_unref(reply); dbus_message_unref(reply);
finish: finish:
if(return_error) if (m)
*return_error=error; dbus_message_unref(m);
if (return_error)
*return_error = error;
else else
dbus_error_free(&error); dbus_error_free(&error);
return r; return r;
} }
void dbus_message_unref_p(DBusMessage **reply) {
if (*reply)
dbus_message_unref(*reply);
}
 End of changes. 10 change blocks. 
13 lines changed or deleted 20 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/