even more M$ tuning
[spider.git] / perl / Msg.pm
index 30519a0764b9c0ddec9dcc7330277cb68d600986..19c81484e5cd95662d489b673bc15f34578e8cdd 100644 (file)
@@ -58,6 +58,8 @@ BEGIN {
        if ($^O eq 'MSWin32') { 
                eval '*EINPROGRESS = sub { 10036 };';
                eval '*EWOULDBLOCK = *EAGAIN = sub { 10035 };';
+               eval '*F_GETFL     = sub {     0 };';
+               eval '*F_SETFL     = sub {     0 };';
                $blocking_supported = 1;
        } 
 }
@@ -125,15 +127,15 @@ sub blocking
                0x80000000 | (4 << 16) | (ord('f') << 8) | 126,
                "$_[1]"
              );
-       }
-       
-       my $flags = fcntl ($_[0], F_GETFL, 0);
-       if ($_[1]) {
-               $flags &= ~O_NONBLOCK;
        } else {
-               $flags |= O_NONBLOCK;
+               my $flags = fcntl ($_[0], F_GETFL, 0);
+               if ($_[1]) {
+                       $flags &= ~O_NONBLOCK;
+               } else {
+                       $flags |= O_NONBLOCK;
+               }
+               fcntl ($_[0], F_SETFL, $flags);
        }
-       fcntl ($_[0], F_SETFL, $flags);
 }
 
 # save it