Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
return true;
}
+
+int lxc_make_tmpfile(char *template, bool rm)
+{
+ int fd, ret;
+
+ fd = mkstemp(template);
+ if (fd < 0)
+ return -1;
+
+ if (!rm)
+ return fd;
+
+ ret = unlink(template);
+ if (ret < 0) {
+ close(fd);
+ return -1;
+ }
+
+ return fd;
+}
extern bool has_fs_type(const char *path, fs_type_magic magic_val);
extern bool is_fs_type(const struct statfs *fs, fs_type_magic magic_val);
extern bool lxc_nic_exists(char *nic);
+extern int lxc_make_tmpfile(char *template, bool rm);
#endif /* __LXC_UTILS_H */