From bc872ab0ce575515fe323b1e02304e02a2e5981e Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Thu, 9 Mar 2023 09:25:28 +0100 Subject: [PATCH] subscribtion cookie: properly remove the cookie --- src/subscriberfuncs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/subscriberfuncs.c b/src/subscriberfuncs.c index 583aaf15..2459eb09 100644 --- a/src/subscriberfuncs.c +++ b/src/subscriberfuncs.c @@ -155,16 +155,19 @@ get_subcookie_content(int listfd, bool unsub, const char *param) return (NULL); } fd = openat(dfd, param, O_RDONLY); - close(dfd); - if (fd == -1) + if (fd == -1) { + close(dfd); return (NULL); + } f = fdopen(fd, "r"); if (getline(&line, &linecap, f) > 0) { chomp(line); fclose(f); unlinkat(dfd, param, 0); + close(dfd); return (line); } + close(dfd); fclose(f); return (NULL); -- 2.47.2