+ return tmpdir;
+}
+
+int unlink_file_destructor(char *filename)
+{
+ unlink(filename);
+ return 0;
+}
+
+char *maybe_temp_file(const void *ctx, const char *extension, bool keep,
+ const char *srcname)
+{
+ unsigned baselen;
+ char *f, *suffix = talloc_strdup(ctx, "");
+ struct stat st;
+ unsigned int count = 0;
+
+ srcname = talloc_basename(ctx, srcname);
+ if (strrchr(srcname, '.'))
+ baselen = strrchr(srcname, '.') - srcname;
+ else
+ baselen = strlen(srcname);