aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 74da0ed1..562cbaf4 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -377,6 +377,16 @@ int notstdio(int fd)
return fd;
}
+int xtempfile(char *name, char **tempname)
+{
+ int fd;
+
+ *tempname = xmprintf("%s%s", name, "XXXXXX");
+ if(-1 == (fd = mkstemp(*tempname))) error_exit("no temp file");
+
+ return fd;
+}
+
// Create a file but don't return stdin/stdout/stderr
int xcreate(char *path, int flags, int mode)
{