diff options
author | Ruediger Meier | 2016-02-29 12:49:13 +0100 |
---|---|---|
committer | Karel Zak | 2016-03-07 15:36:00 +0100 |
commit | 1a048dc5e2c463f2eaf1b8975983185fee080b37 (patch) | |
tree | 56be241832a0478709d7451a38041bacc2c14609 /include/fileutils.h | |
parent | lib: remove openat fallback functions (include/at.h) (diff) | |
download | kernel-qcow2-util-linux-1a048dc5e2c463f2eaf1b8975983185fee080b37.tar.gz kernel-qcow2-util-linux-1a048dc5e2c463f2eaf1b8975983185fee080b37.tar.xz kernel-qcow2-util-linux-1a048dc5e2c463f2eaf1b8975983185fee080b37.zip |
lib: move fopen_at() to fileutils.h, remove at.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'include/fileutils.h')
-rw-r--r-- | include/fileutils.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/fileutils.h b/include/fileutils.h index 79dd01237..1cc007c76 100644 --- a/include/fileutils.h +++ b/include/fileutils.h @@ -28,6 +28,16 @@ static inline FILE *xfmkstemp(char **tmpname, const char *dir, const char *prefi return ret; } +static inline FILE *fopen_at(int dir, const char *filename, + int flags, const char *mode) +{ + int fd = openat(dir, filename, flags); + if (fd < 0) + return NULL; + + return fdopen(fd, mode); +} + static inline int is_same_inode(const int fd, const struct stat *st) { struct stat f; |