use _read() instead of read() on windows
authorKevin Wasserman <krwasserman@hotmail.com>
Tue, 6 Jan 2015 13:16:51 +0000 (08:16 -0500)
committerKevin Wasserman <krwasserman@painless-security.com>
Thu, 15 Jan 2015 19:34:15 +0000 (14:34 -0500)
json_gssapi/main.cpp

index fb7f28a..be5f227 100644 (file)
@@ -1,15 +1,20 @@
 //
 #include <iostream>
+#include <string.h>
 #ifdef WIN32
 #include <stdio.h>
 #include <fcntl.h>
 #include <io.h>
 #else
 #include <unistd.h>
-#include <string.h>
 #endif
 #include <GSSRequest.h>
 
+#ifdef WIN32
+#define gssweb_read _read
+#else
+#define gssweb_read read
+#endif
 
 using std::cin;
 using std::cout;
@@ -38,7 +43,7 @@ int main(int argc, char **argv) {
     readThisRound = readTotal = 0;
     while(4 != readTotal)
     {
-      readThisRound = _read(0, ((&len) + readTotal), 4 - readTotal);
+      readThisRound = gssweb_read(0, ((&len) + readTotal), 4 - readTotal);
       readTotal += readThisRound;
     }
     
@@ -48,7 +53,7 @@ int main(int argc, char **argv) {
     while (readTotal < len)
     {
       readRemaining = len - readTotal;
-      readThisRound = _read( 0, &(input[readTotal]), readRemaining);
+      readThisRound = gssweb_read( 0, &(input[readTotal]), readRemaining);
       if (-1 == readThisRound)
         break;
       else