chiark / gitweb /
importd: add new bus calls for importing local tar and raw images
[elogind.git] / src / bus-proxyd / synthesize.c
index ab73d6e170f2c161f60d2794d487fb2b9f8e7382..542166f68a1f54c6287bfe697a6a5937eb9ee388 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
 #include <stddef.h>
 
-#include "log.h"
 #include "util.h"
 #include "sd-bus.h"
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-util.h"
-#include "strv.h"
-#include "def.h"
-#include "bus-control.h"
 #include "synthesize.h"
 
 static int synthetic_driver_send(sd_bus *b, sd_bus_message *m) {
@@ -83,7 +75,6 @@ int synthetic_reply_method_errorf(sd_bus_message *call, const char *name, const
 }
 
 int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_error *p) {
-
         _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL;
 
         assert(call);
@@ -99,6 +90,22 @@ int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_e
         return synthetic_reply_method_error(call, &berror);
 }
 
+int synthetic_reply_method_errnof(sd_bus_message *call, int error, const char *format, ...) {
+        _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL;
+        va_list ap;
+
+        assert(call);
+
+        if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
+                return 0;
+
+        va_start(ap, format);
+        sd_bus_error_set_errnofv(&berror, error, format, ap);
+        va_end(ap);
+
+        return synthetic_reply_method_error(call, &berror);
+}
+
 int synthetic_reply_method_return(sd_bus_message *call, const char *types, ...) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
         int r;
@@ -125,7 +132,7 @@ int synthetic_reply_method_return(sd_bus_message *call, const char *types, ...)
         return synthetic_driver_send(call->bus, m);
 }
 
-int synthetic_reply_return_strv(sd_bus_message *call, char **l) {
+int synthetic_reply_method_return_strv(sd_bus_message *call, char **l) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
         int r;