2012-02-29 08:58:51 -06:00
|
|
|
#ifndef UTIL_LINUX_FILEUTILS
|
|
|
|
#define UTIL_LINUX_FILEUTILS
|
|
|
|
|
2012-06-02 12:31:30 -05:00
|
|
|
extern int xmkstemp(char **tmpname, char *dir);
|
2012-02-29 08:58:51 -06:00
|
|
|
|
2012-06-02 12:31:30 -05:00
|
|
|
static inline FILE *xfmkstemp(char **tmpname, char *dir)
|
2012-03-10 05:29:35 -06:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
FILE *ret;
|
2012-06-02 12:31:30 -05:00
|
|
|
fd = xmkstemp(tmpname, dir);
|
2012-03-10 05:29:35 -06:00
|
|
|
if (fd == -1) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2013-04-03 09:12:34 -05:00
|
|
|
if (!(ret = fdopen(fd, "w+" UL_CLOEXECSTR))) {
|
2012-03-10 05:29:35 -06:00
|
|
|
close(fd);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2012-04-23 06:52:41 -05:00
|
|
|
|
|
|
|
extern int get_fd_tabsize(void);
|
|
|
|
|
2014-06-09 03:59:18 -05:00
|
|
|
extern int mkdir_p(const char *path, mode_t mode);
|
2014-06-09 04:54:32 -05:00
|
|
|
extern char *stripoff_last_component(char *path);
|
2014-06-09 03:59:18 -05:00
|
|
|
|
2012-04-23 06:52:41 -05:00
|
|
|
#endif /* UTIL_LINUX_FILEUTILS */
|