From 090ee9e6041904bb864b3ec18e80a861b326931b Mon Sep 17 00:00:00 2001 From: Tim Rühsen Date: Thu, 15 Mar 2018 20:59:41 +0100 Subject: Fix race condition in test_get_sendfile/test_get_sendfile11 --- src/testcurl/test_get_sendfile.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c index 6718106d..fb040afe 100644 --- a/src/testcurl/test_get_sendfile.c +++ b/src/testcurl/test_get_sendfile.c @@ -576,15 +576,19 @@ main (int argc, char *const *argv) FILE *f; (void)argc; /* Unused. Silent compiler warning. */ + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if ( (NULL == (tmp = getenv ("TMPDIR"))) && (NULL == (tmp = getenv ("TMP"))) && (NULL == (tmp = getenv ("TEMP"))) ) tmp = "/tmp"; sourcefile = malloc (strlen (tmp) + 32); sprintf (sourcefile, - "%s/%s", + "%s/%s%s", tmp, - "test-mhd-sendfile"); + "test-mhd-sendfile", + oneone ? "11" : ""); f = fopen (sourcefile, "w"); if (NULL == f) { @@ -594,8 +598,6 @@ main (int argc, char *const *argv) } fwrite (TESTSTR, strlen (TESTSTR), 1, f); fclose (f); - oneone = (NULL != strrchr (argv[0], (int) '/')) ? - (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; if (0 != curl_global_init (CURL_GLOBAL_WIN32)) return 2; errorCount += testInternalGet (); -- cgit v1.2.3