diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-03-15 20:59:41 +0100 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-03-15 21:08:52 +0100 |
commit | 090ee9e6041904bb864b3ec18e80a861b326931b (patch) | |
tree | e55ecacd10c48552bc5483a22fe6f6bce4a97063 | |
parent | ea4b7cd39ef8e4c3359e84c5cd456ba757ddf31c (diff) | |
download | libmicrohttpd-090ee9e6041904bb864b3ec18e80a861b326931b.tar.gz libmicrohttpd-090ee9e6041904bb864b3ec18e80a861b326931b.zip |
Fix race condition in test_get_sendfile/test_get_sendfile11
-rw-r--r-- | src/testcurl/test_get_sendfile.c | 10 |
1 files 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) | |||
576 | FILE *f; | 576 | FILE *f; |
577 | (void)argc; /* Unused. Silent compiler warning. */ | 577 | (void)argc; /* Unused. Silent compiler warning. */ |
578 | 578 | ||
579 | oneone = (NULL != strrchr (argv[0], (int) '/')) ? | ||
580 | (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; | ||
581 | |||
579 | if ( (NULL == (tmp = getenv ("TMPDIR"))) && | 582 | if ( (NULL == (tmp = getenv ("TMPDIR"))) && |
580 | (NULL == (tmp = getenv ("TMP"))) && | 583 | (NULL == (tmp = getenv ("TMP"))) && |
581 | (NULL == (tmp = getenv ("TEMP"))) ) | 584 | (NULL == (tmp = getenv ("TEMP"))) ) |
582 | tmp = "/tmp"; | 585 | tmp = "/tmp"; |
583 | sourcefile = malloc (strlen (tmp) + 32); | 586 | sourcefile = malloc (strlen (tmp) + 32); |
584 | sprintf (sourcefile, | 587 | sprintf (sourcefile, |
585 | "%s/%s", | 588 | "%s/%s%s", |
586 | tmp, | 589 | tmp, |
587 | "test-mhd-sendfile"); | 590 | "test-mhd-sendfile", |
591 | oneone ? "11" : ""); | ||
588 | f = fopen (sourcefile, "w"); | 592 | f = fopen (sourcefile, "w"); |
589 | if (NULL == f) | 593 | if (NULL == f) |
590 | { | 594 | { |
@@ -594,8 +598,6 @@ main (int argc, char *const *argv) | |||
594 | } | 598 | } |
595 | fwrite (TESTSTR, strlen (TESTSTR), 1, f); | 599 | fwrite (TESTSTR, strlen (TESTSTR), 1, f); |
596 | fclose (f); | 600 | fclose (f); |
597 | oneone = (NULL != strrchr (argv[0], (int) '/')) ? | ||
598 | (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; | ||
599 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) | 601 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) |
600 | return 2; | 602 | return 2; |
601 | errorCount += testInternalGet (); | 603 | errorCount += testInternalGet (); |