]> granicus.if.org Git - curl/commitdiff
tftpd server: add Windows support by writing files in binary mode
authorMarc Hoersken <info@marc-hoersken.de>
Wed, 23 Dec 2015 12:04:00 +0000 (13:04 +0100)
committerMarc Hoersken <info@marc-hoersken.de>
Wed, 23 Dec 2015 12:04:00 +0000 (13:04 +0100)
tests/server/tftpd.c

index c2c512f11ed37f9cb51b9fea2c47d6e37e2450d4..ffc2496d60f601ff9283ab646224d57a95522f96 100644 (file)
@@ -565,7 +565,11 @@ static ssize_t write_behind(struct testcase *test, int convert)
   if(!test->ofile) {
     char outfile[256];
     snprintf(outfile, sizeof(outfile), "log/upload.%ld", test->testno);
+#ifdef WIN32
+    test->ofile=open(outfile, O_CREAT|O_RDWR|O_BINARY, 0777);
+#else
     test->ofile=open(outfile, O_CREAT|O_RDWR, 0777);
+#endif
     if(test->ofile == -1) {
       logmsg("Couldn't create and/or open file %s for upload!", outfile);
       return -1; /* failure! */