From 7c6568865c907f31e5f50e79b9eb242a2fa49ee5 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Mon, 25 Sep 2023 21:03:19 +0100 Subject: [PATCH] Move smb_bug in pv_crs_fini inside the #if HAVE_IPC block so the code can compile on non IPC systems, as per patch from Benoit Pierre. --- src/pv/cursor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pv/cursor.c b/src/pv/cursor.c index 43a3fb9..51a3b55 100644 --- a/src/pv/cursor.c +++ b/src/pv/cursor.c @@ -636,12 +636,9 @@ void pv_crs_fini(pvstate_t state) { char cup_cmd[32]; /* flawfinder: ignore */ unsigned int y; - struct shmid_ds shm_buf; /* flawfinder - "cup_cmd" is zeroed, and only written by pv_snprintf() */ - memset(&shm_buf, 0, sizeof(shm_buf)); - debug("%s", "fini"); y = (unsigned int) (state->crs_y_start); @@ -692,8 +689,11 @@ void pv_crs_fini(pvstate_t state) * If we are the last instance detaching from the shared memory, * delete it so it's not left lying around. */ - if (state->crs_pvcount < 2) + if (state->crs_pvcount < 2) { + struct shmid_ds shm_buf; + memset(&shm_buf, 0, sizeof(shm_buf)); (void) shmctl(state->crs_shmid, IPC_RMID, &shm_buf); + } #endif /* HAVE_IPC */