[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/35] vl: Conditionally register PID file unlink notifier
From: |
Hanna Reitz |
Subject: |
[PULL 34/35] vl: Conditionally register PID file unlink notifier |
Date: |
Tue, 12 Jul 2022 20:08:52 +0200 |
Currently, the exit notifier for unlinking the PID file is registered
unconditionally. Limit it to only when we actually do create a PID
file.
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220609122701.17172-3-hreitz@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
softmmu/vl.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 3f264d4b09..36f46fcdad 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1526,9 +1526,7 @@ static Notifier qemu_unlink_pidfile_notifier;
static void qemu_unlink_pidfile(Notifier *n, void *data)
{
- if (pid_file) {
- unlink(pid_file);
- }
+ unlink(pid_file);
}
static const QEMUOption *lookup_opt(int argc, char **argv,
@@ -2431,13 +2429,15 @@ static void qemu_maybe_daemonize(const char *pid_file)
os_daemonize();
rcu_disable_atfork();
- if (pid_file && !qemu_write_pidfile(pid_file, &err)) {
- error_reportf_err(err, "cannot create PID file: ");
- exit(1);
- }
+ if (pid_file) {
+ if (!qemu_write_pidfile(pid_file, &err)) {
+ error_reportf_err(err, "cannot create PID file: ");
+ exit(1);
+ }
- qemu_unlink_pidfile_notifier.notify = qemu_unlink_pidfile;
- qemu_add_exit_notifier(&qemu_unlink_pidfile_notifier);
+ qemu_unlink_pidfile_notifier.notify = qemu_unlink_pidfile;
+ qemu_add_exit_notifier(&qemu_unlink_pidfile_notifier);
+ }
}
static void qemu_init_displays(void)
--
2.35.3
- [PULL 22/35] block: Change blk_pwrite_compressed() param order, (continued)
- [PULL 22/35] block: Change blk_pwrite_compressed() param order, Hanna Reitz, 2022/07/12
- [PULL 21/35] block: Export blk_pwritev_part() in block-backend-io.h, Hanna Reitz, 2022/07/12
- [PULL 18/35] block: Implement blk_{pread, pwrite}() using generated_co_wrapper, Hanna Reitz, 2022/07/12
- [PULL 26/35] block: Implement blk_flush() using generated_co_wrapper, Hanna Reitz, 2022/07/12
- [PULL 27/35] block: Add blk_co_ioctl(), Hanna Reitz, 2022/07/12
- [PULL 30/35] block: Remove remaining unused symbols in coroutines.h, Hanna Reitz, 2022/07/12
- [PULL 23/35] block: Add blk_co_pwrite_compressed(), Hanna Reitz, 2022/07/12
- [PULL 29/35] block: Reorganize some declarations in block-backend-io.h, Hanna Reitz, 2022/07/12
- [PULL 32/35] iotests/297: Have mypy ignore unused ignores, Hanna Reitz, 2022/07/12
- [PULL 33/35] qsd: Unlink absolute PID file path, Hanna Reitz, 2022/07/12
- [PULL 34/35] vl: Conditionally register PID file unlink notifier,
Hanna Reitz <=
- [PULL 35/35] vl: Unlink absolute PID file path, Hanna Reitz, 2022/07/12
- Re: [PULL 00/35] Block patches, Peter Maydell, 2022/07/13