]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/machine/operation.c
Merge pull request #17549 from yuwata/tiny-fixes
[thirdparty/systemd.git] / src / machine / operation.c
index 2bf93cb49336a10e629362a8916df8d02e8f17b6..34565e3e69532f93be43a89a9e9d5bb9641b2ffb 100644 (file)
@@ -1,21 +1,6 @@
-/***
-  This file is part of systemd.
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-  Copyright 2016 Lennart Poettering
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
+#include <sys/wait.h>
 
 #include "alloc-util.h"
 #include "fd-util.h"
@@ -61,8 +46,10 @@ static int operation_done(sd_event_source *s, const siginfo_t *si, void *userdat
         } else {
                 /* The default operation when done is to simply return an error on failure or an empty success
                  * message on success. */
-                if (r < 0)
+                if (r < 0) {
+                        sd_bus_error_set_errno(&error, r);
                         goto fail;
+                }
 
                 r = sd_bus_reply_method_return(o->message, NULL);
                 if (r < 0)
@@ -147,6 +134,5 @@ Operation *operation_free(Operation *o) {
         if (o->machine)
                 LIST_REMOVE(operations_by_machine, o->machine->operations, o);
 
-        free(o);
-        return NULL;
+        return mfree(o);
 }