]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - include/fileutils.h
1 #ifndef UTIL_LINUX_FILEUTILS
2 #define UTIL_LINUX_FILEUTILS
11 extern int mkstemp_cloexec(char *template);
13 extern int xmkstemp(char **tmpname
, const char *dir
, const char *prefix
);
15 static inline FILE *xfmkstemp(char **tmpname
, const char *dir
, const char *prefix
)
20 fd
= xmkstemp(tmpname
, dir
, prefix
);
24 if (!(ret
= fdopen(fd
, "w+" UL_CLOEXECSTR
))) {
32 static inline FILE *fopen_at(int dir
, const char *filename
,
33 int flags
, const char *mode
)
35 int fd
= openat(dir
, filename
, flags
);
39 return fdopen(fd
, mode
);
43 static inline int is_same_inode(const int fd
, const struct stat
*st
)
47 if (fstat(fd
, &f
) < 0)
49 else if (f
.st_dev
!= st
->st_dev
|| f
.st_ino
!= st
->st_ino
)
54 extern int dup_fd_cloexec(int oldfd
, int lowfd
);
55 extern int get_fd_tabsize(void);
57 extern int mkdir_p(const char *path
, mode_t mode
);
58 extern char *stripoff_last_component(char *path
);
60 #endif /* UTIL_LINUX_FILEUTILS */