Skip to contentSkip to conversation

system/exit-with-parent.c: Close the file descriptor before exit

PATCH In review Richard W.M. Jones 2 participants 2 messages May 18 – May 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 system/exit-with-parent.c: Close the file descriptor before exit

On macOS we leak the open file descriptor in the background thread. Close it before returning.

Reported-by Thomas Huth
Fixes commit 886898baad ("Implement -run-with exit-with-parent=on")
---
 system/exit-with-parent.c | 1 +
 1 file changed, 1 insertion(+)
system/exit-with-parent.c +1 -0
index df65d2231a..d236944572 100644
@@ -109,6 +109,7 @@ exit_with_parent_loop(void *vp)
         /* Behave like Linux and FreeBSD above, as if SIGTERM was sent */
         qemu_system_killed(SIGTERM, ppid);
     }
+    close(fd);
 
     return NULL;
 }
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Richard W.M. Jones

On macOS we leak the open file descriptor in the background thread. Close it before returning.

Reported-by Thomas Huth
Fixes commit 886898baad ("Implement -run-with exit-with-parent=on")
---
  system/exit-with-parent.c | 1 +
  1 file changed, 1 insertion(+)
system/exit-with-parent.c +0 -0
index df65d2231a..d236944572 100644

system/exit-with-parent.c exit_with_parent_loop(void *vp) · line 115

Quoted 7 lines
system/exit-with-parent.c +1 -0
@@ -109,6 +109,7 @@ exit_with_parent_loop(void *vp)
          /* Behave like Linux and FreeBSD above, as if SIGTERM was sent */
          qemu_system_killed(SIGTERM, ppid);
      }
+    close(fd);
 
      return NULL;
  }