@@ -86,6 +86,29 @@ create_temp_file (const char *base, char **filename)
return fd;
}
+int
+support_create_temp_fifo (const char *base, char **fifoname)
+{
+ char *fname = xasprintf ("%s/%sXXXXXX", test_dir, base);
+ mktemp (fname);
+
+ int fd = mkfifo (fname, 0600);
+ if (fd == -1)
+ {
+ printf ("cannot open temporary fifo '%s': %m\n", fname);
+ free (fname);
+ return -1;
+ }
+
+ add_temp_file (fname);
+ if (fifoname != NULL)
+ *fifoname = fname;
+ else
+ free (fname);
+
+ return fd;
+}
+
char *
support_create_temp_directory (const char *base)
{
@@ -32,6 +32,12 @@ void add_temp_file (const char *name);
*FILENAME. */
int create_temp_file (const char *base, char **filename);
+/* Create a temporary fifo. Return the opened file descriptor on
+ success, or -1 on failure. Write the file name to *FILENAME if
+ FILENAME is not NULL. In this case, the caller is expected to free
+ *FILENAME. */
+int support_create_temp_fifo (const char *name, char **fifoname);
+
/* Create a temporary directory and schedule it for deletion. BASE is
used as a prefix for the unique directory name, which the function
returns. The caller should free this string. */