summaryrefslogtreecommitdiff
path: root/src/libposixplz/mklinktemp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libposixplz/mklinktemp.c')
-rw-r--r--src/libposixplz/mklinktemp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libposixplz/mklinktemp.c b/src/libposixplz/mklinktemp.c
new file mode 100644
index 0000000..d1bee4b
--- /dev/null
+++ b/src/libposixplz/mklinktemp.c
@@ -0,0 +1,21 @@
+/* ISC license. */
+
+#include <unistd.h>
+
+#include <skalibs/djbunix.h>
+#include <skalibs/posixplz.h>
+
+#include "posixplz-internal.h"
+
+static int f (char const *dst, mode_t mode, void *data)
+{
+ linkarg_t *la = data ;
+ (void)mode ;
+ return (*la->lf)(la->src, dst) ;
+}
+
+int mklinktemp (char const *src, char *dst, linkfunc_t_ref lf)
+{
+ linkarg_t la = { .lf = lf, .src = src } ;
+ return mkfiletemp(dst, &f, 0600, &la) ;
+}