summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-memfd.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-01-14 20:15:25 +0800
committerKay Sievers <kay@vrfy.org>2014-01-14 20:17:24 +0800
commit135a4eb43449bd64e4ec262573a6ffe29a5ffd03 (patch)
treedb7151230eb9422ccec1a3025019b89c87d2755e /src/libsystemd/sd-memfd.c
parent9597086027a937edfd7a3f5e5999796d2b34c8ad (diff)
bus: update kdbus.h (ABI break)
Diffstat (limited to 'src/libsystemd/sd-memfd.c')
-rw-r--r--src/libsystemd/sd-memfd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsystemd/sd-memfd.c b/src/libsystemd/sd-memfd.c
index cd95978ac2..112c95fb43 100644
--- a/src/libsystemd/sd-memfd.c
+++ b/src/libsystemd/sd-memfd.c
@@ -35,9 +35,11 @@ struct sd_memfd {
};
_public_ int sd_memfd_new(sd_memfd **m) {
+ struct kdbus_cmd_memfd_make cmd = {
+ .size = sizeof(struct kdbus_cmd_memfd_make),
+ };
_cleanup_close_ int kdbus = -1;
sd_memfd *n;
- int fd;
assert_return(m, -EINVAL);
@@ -45,14 +47,16 @@ _public_ int sd_memfd_new(sd_memfd **m) {
if (kdbus < 0)
return -errno;
- if (ioctl(kdbus, KDBUS_CMD_MEMFD_NEW, &fd) < 0)
+ if (ioctl(kdbus, KDBUS_CMD_MEMFD_NEW, &cmd) < 0)
return -errno;
n = new0(struct sd_memfd, 1);
- if (!n)
+ if (!n) {
+ close_nointr_nofail(cmd.fd);
return -ENOMEM;
+ }
- n->fd = fd;
+ n->fd = cmd.fd;
*m = n;
return 0;
}