serialize: add serialize_fd_many() helper

This commit is contained in:
Lennart Poettering
2023-10-18 13:51:02 +02:00
parent c2e42d4b88
commit 3b444970e6
5 changed files with 99 additions and 139 deletions
+7
View File
@@ -99,6 +99,13 @@ void close_many(const int fds[], size_t n_fd) {
safe_close(fds[i]);
}
void close_many_and_free(int *fds, size_t n_fds) {
assert(fds || n_fds <= 0);
close_many(fds, n_fds);
free(fds);
}
int fclose_nointr(FILE *f) {
assert(f);
+1
View File
@@ -30,6 +30,7 @@ static inline int safe_close_above_stdio(int fd) {
}
void close_many(const int fds[], size_t n_fd);
void close_many_and_free(int *fds, size_t n_fds);
int fclose_nointr(FILE *f);
FILE* safe_fclose(FILE *f);