summaryrefslogtreecommitdiffstats
path: root/semihosting/console.c
diff options
context:
space:
mode:
authorHanna Reitz2022-06-09 14:27:01 +0200
committerHanna Reitz2022-07-12 14:31:15 +0200
commit85c4bf8aa6c93c24876e8870ae7cf8ab2e5a96cf (patch)
tree0af33e78d3e63391fbbbc9a798cf6c4e795cef79 /semihosting/console.c
parentvl: Conditionally register PID file unlink notifier (diff)
downloadqemu-85c4bf8aa6c93c24876e8870ae7cf8ab2e5a96cf.tar.gz
qemu-85c4bf8aa6c93c24876e8870ae7cf8ab2e5a96cf.tar.xz
qemu-85c4bf8aa6c93c24876e8870ae7cf8ab2e5a96cf.zip
vl: Unlink absolute PID file path
After writing the PID file, we register an exit notifier to unlink it when the process terminates. However, if the process has changed its working directory in the meantime (e.g. in os_setup_post() when daemonizing), this will not work when the PID file path was relative. Therefore, pass the absolute path (created with realpath()) to the unlink() call in the exit notifier. (realpath() needs a path pointing to an existing file, so we cannot use it before qemu_write_pidfile().) Reproducer: $ cd /tmp $ qemu-system-x86_64 --daemonize --pidfile qemu.pid $ file qemu.pid qemu.pid: ASCII text $ kill $(cat qemu.pid) $ file qemu.pid qemu.pid: ASCII text (qemu.pid should be gone after the process has terminated.) Signed-off-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220609122701.17172-4-hreitz@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'semihosting/console.c')
0 files changed, 0 insertions, 0 deletions