]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/import/importd.c
tree-wide: use mfree more
[thirdparty/systemd.git] / src / import / importd.c
index d2a5867a6edefd2b22f25c70166e7e9897dbf1d1..9d31a956a548e0362b644b822ae65e488c5827a3 100644 (file)
@@ -141,8 +141,7 @@ static Transfer *transfer_unref(Transfer *t) {
         safe_close(t->stdin_fd);
         safe_close(t->stdout_fd);
 
-        free(t);
-        return NULL;
+        return mfree(t);
 }
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Transfer*, transfer_unref);
@@ -448,9 +447,7 @@ static int transfer_start(Transfer *t) {
                                 safe_close(null_fd);
                 }
 
-                fd_cloexec(STDIN_FILENO, false);
-                fd_cloexec(STDOUT_FILENO, false);
-                fd_cloexec(STDERR_FILENO, false);
+                stdio_unset_cloexec();
 
                 setenv("SYSTEMD_LOG_TARGET", "console-prefixed", 1);
                 setenv("NOTIFY_SOCKET", "/run/systemd/import/notify", 1);
@@ -550,8 +547,7 @@ static Manager *manager_unref(Manager *m) {
         m->bus = sd_bus_flush_close_unref(m->bus);
         sd_event_unref(m->event);
 
-        free(m);
-        return NULL;
+        return mfree(m);
 }
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_unref);
@@ -677,7 +673,7 @@ static int manager_new(Manager **ret) {
         (void) mkdir_parents_label(sa.un.sun_path, 0755);
         (void) unlink(sa.un.sun_path);
 
-        if (bind(m->notify_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path)) < 0)
+        if (bind(m->notify_fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0)
                 return -errno;
 
         if (setsockopt(m->notify_fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0)