From 1481e167cf8867519a18b894d222dbdf429fd300 Mon Sep 17 00:00:00 2001 From: chrchr Date: Mon, 4 Dec 2023 12:21:24 +0100 Subject: [PATCH] Remove TODO, fix --- test/cfg/posix.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/test/cfg/posix.c b/test/cfg/posix.c index 617d678125e..31489299b2a 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -1060,6 +1060,13 @@ void resourceLeak_fdopen(int fd) // cppcheck-suppress resourceLeak } +void resourceLeak_fdopen2(const char* fn) // #2767 +{ + int fi = open(fn, O_RDONLY); + FILE* fd = fdopen(fi, "r"); + fclose(fd); +} + void resourceLeak_mkstemp(char *template) { // cppcheck-suppress unreadVariable @@ -1113,13 +1120,6 @@ void resourceLeak_open2(void) // cppcheck-suppress resourceLeak } -void resourceLeak_fdopen(const char* fn) // #2767 -{ - int fi = open(fn, O_RDONLY); - FILE* fd = fdopen(fi, "r"); - fclose(fd); -} - void noleak(int x, int y, int z) { DIR *p1 = fdopendir(x); @@ -1132,12 +1132,6 @@ void noleak(int x, int y, int z) close(fd1); int fd2 = open("a", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); close(fd2); - /* TODO: add configuration for open/fdopen - // #2830 - int fd = open("path", O_RDONLY); - FILE *f = fdopen(fd, "rt"); - fclose(f); - */ }