]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredump: store actual fd in appropriate variable
authorMichal Sekletar <msekleta@redhat.com>
Mon, 9 Sep 2024 16:31:57 +0000 (18:31 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 30 Oct 2024 12:20:40 +0000 (12:20 +0000)
src/coredump/coredump.c

index 0900689d04275c1f530b23f39d5d03c2c956465b..c15189b4ea6bf37001298a51e67f43e9cc9a7445 100644 (file)
@@ -1691,13 +1691,13 @@ static int gather_pid_mount_tree_fd(const Context *context) {
         if (r == 0) {
                 pair[0] = safe_close(pair[0]);
 
-                r = open_tree(-EBADF, "/", AT_NO_AUTOMOUNT | AT_RECURSIVE | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLOEXEC | OPEN_TREE_CLONE);
-                if (r < 0) {
+                fd = open_tree(-EBADF, "/", AT_NO_AUTOMOUNT | AT_RECURSIVE | AT_SYMLINK_NOFOLLOW | OPEN_TREE_CLOEXEC | OPEN_TREE_CLONE);
+                if (fd < 0) {
                         log_error_errno(errno, "Failed to clone mount tree: %m");
                         _exit(EXIT_FAILURE);
                 }
 
-                r = send_one_fd(pair[1], r, 0);
+                r = send_one_fd(pair[1], fd, 0);
                 if (r < 0) {
                         log_error_errno(r, "Failed to send mount tree to parent: %m");
                         _exit(EXIT_FAILURE);