mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 06:52:22 +03:00
fileio: add take_fdopendir() variant
fdopendir() wrapper analogous to take_fdopen()
This commit is contained in:
parent
4fa744a35c
commit
f61457b0fe
@ -80,6 +80,18 @@ FILE* take_fdopen(int *fd, const char *options) {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIR* take_fdopendir(int *dfd) {
|
||||||
|
assert(dfd);
|
||||||
|
|
||||||
|
DIR *d = fdopendir(*dfd);
|
||||||
|
if (!d)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
*dfd = -1;
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
FILE* open_memstream_unlocked(char **ptr, size_t *sizeloc) {
|
FILE* open_memstream_unlocked(char **ptr, size_t *sizeloc) {
|
||||||
FILE *f = open_memstream(ptr, sizeloc);
|
FILE *f = open_memstream(ptr, sizeloc);
|
||||||
if (!f)
|
if (!f)
|
||||||
|
@ -41,6 +41,7 @@ int fopen_unlocked(const char *path, const char *options, FILE **ret);
|
|||||||
int fdopen_unlocked(int fd, const char *options, FILE **ret);
|
int fdopen_unlocked(int fd, const char *options, FILE **ret);
|
||||||
int take_fdopen_unlocked(int *fd, const char *options, FILE **ret);
|
int take_fdopen_unlocked(int *fd, const char *options, FILE **ret);
|
||||||
FILE* take_fdopen(int *fd, const char *options);
|
FILE* take_fdopen(int *fd, const char *options);
|
||||||
|
DIR* take_fdopendir(int *dfd);
|
||||||
FILE* open_memstream_unlocked(char **ptr, size_t *sizeloc);
|
FILE* open_memstream_unlocked(char **ptr, size_t *sizeloc);
|
||||||
FILE* fmemopen_unlocked(void *buf, size_t size, const char *mode);
|
FILE* fmemopen_unlocked(void *buf, size_t size, const char *mode);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user