diff --git a/lib/tempname.c b/lib/tempname.c
-index 49c7df1..84a45d4 100644
+index 69c572f..1920274 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -20,6 +20,7 @@
int
-__try_tempname (char *tmpl, int suffixlen, void *args,
-- int (*try) (char *, void *))
+- int (*tryfunc) (char *, void *))
+try_tempname_len (char *tmpl, int suffixlen, void *args,
-+ int (*try) (char *, void *), size_t x_suffix_len)
++ int (*tryfunc) (char *, void *), size_t x_suffix_len)
{
- int len;
+ size_t len;
+ for (i = 0; i < x_suffix_len; i++)
+ XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
- fd = try (tmpl, args);
+ fd = tryfunc (tmpl, args);
if (fd >= 0)
{
__set_errno (save_errno);
}
static int
-@@ -285,9 +291,10 @@ try_nocreate (char *tmpl, void *flags)
+@@ -285,9 +291,10 @@ try_nocreate (char *tmpl, void *flags _GL_UNUSED)
}
/* Generate a temporary file name based on TMPL. TMPL must match the
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
-@@ -298,7 +305,8 @@ try_nocreate (char *tmpl, void *flags)
+@@ -298,7 +305,8 @@ try_nocreate (char *tmpl, void *flags _GL_UNUSED)
We use a clever algorithm to get hard-to-predict names. */
int
+gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len)
{
- int (*try) (char *, void *);
+ int (*tryfunc) (char *, void *);
@@ -320,5 +328,18 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
assert (! "invalid KIND in __gen_tempname");
abort ();
}
-- return __try_tempname (tmpl, suffixlen, &flags, try);
-+ return try_tempname_len (tmpl, suffixlen, &flags, try, x_suffix_len);
+- return __try_tempname (tmpl, suffixlen, &flags, tryfunc);
++ return try_tempname_len (tmpl, suffixlen, &flags, tryfunc, x_suffix_len);
+}
+
+int
+
+int
+__try_tempname (char *tmpl, int suffixlen, void *args,
-+ int (*try) (char *, void *))
++ int (*tryfunc) (char *, void *))
+{
-+ return try_tempname_len (tmpl, suffixlen, args, try, 6);
++ return try_tempname_len (tmpl, suffixlen, args, tryfunc, 6);
}
diff --git a/lib/tempname.h b/lib/tempname.h
-index f7c98d0..793207f 100644
+index e609360..6029b9f 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
-@@ -46,6 +46,8 @@
+@@ -50,6 +50,8 @@ extern "C" {
We use a clever algorithm to get hard-to-predict names. */
extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
+extern int gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len);
- /* Similar to gen_tempname, but TRY is called for each temporary
- name to try. If TRY returns a non-negative number, TRY_GEN_TEMPNAME
-@@ -53,5 +55,7 @@ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
+ /* Similar to gen_tempname, but TRYFUNC is called for each temporary
+ name to try. If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME
+@@ -57,6 +59,9 @@ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
name is tried, or else TRY_GEN_TEMPNAME returns -1. */
extern int try_tempname (char *tmpl, int suffixlen, void *args,
- int (*try) (char *, void *));
+ int (*tryfunc) (char *, void *));
+extern int try_tempname_len (char *tmpl, int suffixlen, void *args,
-+ int (*try) (char *, void *), size_t x_suffix_len);
++ int (*tryfunc) (char *, void *),
++ size_t x_suffix_len);
- #endif /* GL_TEMPNAME_H */
+ #ifdef __cplusplus
+ }