[master] 117c2bd Remove now unused VFIL_tmpfile()

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 10 16:18:15 CET 2015


commit 117c2bdcfbb8c11f48bd9137e76edfc746dfbe71
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 10 10:53:42 2015 +0000

    Remove now unused VFIL_tmpfile()

diff --git a/include/vfil.h b/include/vfil.h
index dff6560..97484ad 100644
--- a/include/vfil.h
+++ b/include/vfil.h
@@ -30,7 +30,6 @@
 
 /* from libvarnish/vfil.c */
 int seed_random(void);
-int VFIL_tmpfile(char *);
 char *VFIL_readfile(const char *pfx, const char *fn, ssize_t *sz);
 char *VFIL_readfd(int fd, ssize_t *sz);
 int VFIL_nonblocking(int fd);
diff --git a/lib/libvarnish/vfil.c b/lib/libvarnish/vfil.c
index 0b035da..1a48231 100644
--- a/lib/libvarnish/vfil.c
+++ b/lib/libvarnish/vfil.c
@@ -56,43 +56,6 @@
 #include "vdef.h"
 #include "vfil.h"
 
-int
-VFIL_tmpfile(char *template)
-{
-	char *b, *e, *p;
-	int fd;
-	char ran;
-
-	for (b = template; *b != '#'; ++b)
-		/* nothing */ ;
-	if (*b == '\0') {
-		errno = EINVAL;
-		return (-1);
-	}
-	for (e = b; *e == '#'; ++e)
-		/* nothing */ ;
-
-	for (;;) {
-		for (p = b; p < e; ++p) {
-			ran = random() % 63;
-			if (ran < 10)
-				*p = '0' + ran;
-			else if (ran < 36)
-				*p = 'A' + ran - 10;
-			else if (ran < 62)
-				*p = 'a' + ran - 36;
-			else
-				*p = '_';
-		}
-		fd = open(template, O_RDWR|O_CREAT|O_EXCL, 0600);
-		if (fd >= 0)
-			return (fd);
-		if (errno != EEXIST)
-			return (-1);
-	}
-	/* not reached */
-}
-
 char *
 VFIL_readfd(int fd, ssize_t *sz)
 {



More information about the varnish-commit mailing list