X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd%2Fsd-bus%2Fsd-memfd.c;h=fcf3e73124ab27319eb1e5e305e8500317a97d36;hb=d2e7b05f248a03dc528f4a270dac2ac3ff3e605a;hp=b78ea6a313b9a686a10e96d663c8c6644f29b456;hpb=8d1db1d154c1134c9bf92b202ef198cc79979ea8;p=elogind.git diff --git a/src/libsystemd/sd-bus/sd-memfd.c b/src/libsystemd/sd-bus/sd-memfd.c index b78ea6a31..fcf3e7312 100644 --- a/src/libsystemd/sd-bus/sd-memfd.c +++ b/src/libsystemd/sd-bus/sd-memfd.c @@ -27,6 +27,7 @@ #include "util.h" #include "kdbus.h" +#include "bus-label.h" #include "sd-memfd.h" #include "sd-bus.h" @@ -36,7 +37,7 @@ struct sd_memfd { FILE *f; }; -_public_ int sd_memfd_new(const char *name, sd_memfd **m) { +_public_ int sd_memfd_new(sd_memfd **m, const char *name) { struct kdbus_cmd_memfd_make *cmd; struct kdbus_item *item; @@ -56,7 +57,7 @@ _public_ int sd_memfd_new(const char *name, sd_memfd **m) { * set here, let's do the usual bus escaping to deal * with that. */ - g = sd_bus_label_escape(name); + g = bus_label_escape(name); if (!g) return -ENOMEM; @@ -76,7 +77,7 @@ _public_ int sd_memfd_new(const char *name, sd_memfd **m) { else { _cleanup_free_ char *e = NULL; - e = sd_bus_label_escape(pr); + e = bus_label_escape(pr); if (!e) return -ENOMEM; @@ -106,7 +107,7 @@ _public_ int sd_memfd_new(const char *name, sd_memfd **m) { n = new0(struct sd_memfd, 1); if (!n) { - close_nointr_nofail(cmd->fd); + safe_close(cmd->fd); return -ENOMEM; } @@ -115,7 +116,7 @@ _public_ int sd_memfd_new(const char *name, sd_memfd **m) { return 0; } -_public_ int sd_memfd_make(int fd, sd_memfd **m) { +_public_ int sd_memfd_new_from_fd(sd_memfd **m, int fd) { sd_memfd *n; uint64_t sz; @@ -143,7 +144,7 @@ _public_ void sd_memfd_free(sd_memfd *m) { if (m->f) fclose(m->f); else - close_nointr_nofail(m->fd); + safe_close(m->fd); free(m); } @@ -249,11 +250,11 @@ _public_ int sd_memfd_set_size(sd_memfd *m, uint64_t sz) { return r; } -_public_ int sd_memfd_new_and_map(const char *name, sd_memfd **m, size_t sz, void **p) { +_public_ int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, void **p) { sd_memfd *n; int r; - r = sd_memfd_new(name, &n); + r = sd_memfd_new(&n, name); if (r < 0) return r; @@ -311,7 +312,7 @@ _public_ int sd_memfd_get_name(sd_memfd *m, char **name) { if (!n) return -ENOMEM; - e = sd_bus_label_unescape(n); + e = bus_label_unescape(n); if (!e) return -ENOMEM;