2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

util: added cleanup_file attribute.

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2025-01-16 07:52:42 +00:00 committed by Andrei Vagin
parent d4d3937017
commit ea2ddb886a

View File

@ -406,6 +406,14 @@ static inline void cleanup_freep(void *p)
free(*pp); free(*pp);
} }
#define cleanup_file __attribute__((cleanup(cleanup_filep)))
static inline void cleanup_filep(FILE **f)
{
FILE *file = *f;
if (file)
(void)fclose(file);
}
extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void *args); extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void *args);
/* /*