Make the tempfile creation dependent on whether the required template is
present. Currently unused, this is just prep work for future patches.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 test/litest.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/test/litest.c b/test/litest.c
index b72ec444..0e050789 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -1104,13 +1104,20 @@ litest_copy_file(const char *dest, const char *src, 
const char *header)
 {
        int in, out, length;
        struct created_file *file;
-       int suffixlen;
 
        file = zalloc(sizeof(*file));
        file->path = safe_strdup(dest);
 
-       suffixlen = file->path + strlen(file->path)  - rindex(file->path, '.');
-       out = mkstemps(file->path, suffixlen);
+       if (strstr(dest, "XXXXXX")) {
+               int suffixlen;
+
+               suffixlen = file->path +
+                               strlen(file->path) -
+                               rindex(file->path, '.');
+               out = mkstemps(file->path, suffixlen);
+       } else {
+               out = open(file->path, O_CREAT|O_WRONLY);
+       }
        if (out == -1)
                litest_abort_msg("Failed to write to file %s (%s)\n",
                                 file->path,
-- 
2.14.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to