aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-01-17 10:28:32 +0000
committerChristian Grothoff <christian@grothoff.org>2013-01-17 10:28:32 +0000
commit78927ac9d6cf01d87b444004e773c881e7319b4c (patch)
tree5667d992c74ba1f7ac53c25d72442e92e7806f0e /src
parent197e2b90cb1b166b613033e07a659eac0f811b07 (diff)
downloadgnunet-78927ac9d6cf01d87b444004e773c881e7319b4c.tar.gz
gnunet-78927ac9d6cf01d87b444004e773c881e7319b4c.zip
minor style stuff
Diffstat (limited to 'src')
-rw-r--r--src/vpn/gnunet-helper-vpn-windows.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/vpn/gnunet-helper-vpn-windows.c b/src/vpn/gnunet-helper-vpn-windows.c
index 9d4657354..5249bfd70 100644
--- a/src/vpn/gnunet-helper-vpn-windows.c
+++ b/src/vpn/gnunet-helper-vpn-windows.c
@@ -175,7 +175,7 @@ WINBASEAPI HANDLE WINAPI ReOpenFile (HANDLE, DWORD, DWORD, DWORD);
175 * * EPIPE (could not read STDOUT) 175 * * EPIPE (could not read STDOUT)
176 */ 176 */
177static int 177static int
178execute_shellcommand (char * command) 178execute_shellcommand (const char *command)
179{ 179{
180 FILE *pipe; 180 FILE *pipe;
181 181
@@ -186,7 +186,7 @@ execute_shellcommand (char * command)
186#ifdef TESTING 186#ifdef TESTING
187 char output[LINE_LEN]; 187 char output[LINE_LEN];
188 while (NULL != fgets (output, sizeof (output), pipe)) 188 while (NULL != fgets (output, sizeof (output), pipe))
189 printf (output); 189 fprintf (stderr, "%s", output);
190#endif 190#endif
191 191
192 return _pclose (pipe); 192 return _pclose (pipe);
@@ -365,6 +365,8 @@ setup_interface ()
365 &DeviceNode)) 365 &DeviceNode))
366 return FALSE; 366 return FALSE;
367 367
368 /* This system call tends to take a while (several seconds!) on
369 "modern" Windoze systems */
368 if (!UpdateDriverForPlugAndPlayDevicesA (NULL, 370 if (!UpdateDriverForPlugAndPlayDevicesA (NULL,
369 secondary_hwid, 371 secondary_hwid,
370 inf_file_path, 372 inf_file_path,
@@ -435,7 +437,7 @@ resolve_interface_name ()
435 char adapter[] = INTERFACE_REGISTRY_LOCATION; 437 char adapter[] = INTERFACE_REGISTRY_LOCATION;
436 438
437 /* Registry is incredibly slow, wait a few seconds for it to refresh */ 439 /* Registry is incredibly slow, wait a few seconds for it to refresh */
438 sleep (5); 440 sleep (5); // FIXME: instead use sleep (1) in a retrying loop; maybe even nanosleep for 50-250ms instead
439 441
440 /* We can obtain the PNP instance ID from our setupapi handle */ 442 /* We can obtain the PNP instance ID from our setupapi handle */
441 device_details.cbSize = sizeof (device_details); 443 device_details.cbSize = sizeof (device_details);
@@ -661,7 +663,7 @@ tun_up (HANDLE handle)
661 } 663 }
662 664
663 /* Wait for the device to go UP, might take some time. */ 665 /* Wait for the device to go UP, might take some time. */
664 Sleep ((TAP32_POSTUP_WAITTIME)*1000); 666 Sleep (TAP32_POSTUP_WAITTIME * 1000);
665 667
666 return TRUE; 668 return TRUE;
667 669
@@ -696,8 +698,9 @@ static boolean
696attempt_read (struct io_facility * input_facility, 698attempt_read (struct io_facility * input_facility,
697 struct io_facility * output_facility) 699 struct io_facility * output_facility)
698{ 700{
699 701 switch (input_facility->facility_state)
700 if (IOSTATE_READY == input_facility->facility_state) 702 {
703 case IOSTATE_READY:
701 { 704 {
702 if (!ResetEvent (input_facility->overlapped.hEvent)) 705 if (!ResetEvent (input_facility->overlapped.hEvent))
703 { 706 {
@@ -753,8 +756,9 @@ attempt_read (struct io_facility * input_facility,
753 } 756 }
754 } 757 }
755 } 758 }
759 return TRUE;
756 // We are queued and should check if the read has finished 760 // We are queued and should check if the read has finished
757 else if (IOSTATE_QUEUED == input_facility->facility_state) 761 case IOSTATE_QUEUED:
758 { 762 {
759 // there was an operation going on already, check if that has completed now. 763 // there was an operation going on already, check if that has completed now.
760 input_facility->status = GetOverlappedResult (input_facility->handle, 764 input_facility->status = GetOverlappedResult (input_facility->handle,
@@ -798,7 +802,10 @@ attempt_read (struct io_facility * input_facility,
798 } 802 }
799 } 803 }
800 } 804 }
801 return TRUE; 805 return TRUE;
806 default:
807 return TRUE;
808 }
802} 809}
803 810
804/** 811/**