diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-13 08:38:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-13 08:38:15 +0000 |
commit | 10cb56ae4e463e404d4d3ba2147340809d608ed8 (patch) | |
tree | a41c0221353bd551bb03755378c83f1bb5c77634 /src/util/os_installation.c | |
parent | 8bbc25e641ce26ecd424ffa12dd4f2f1d8c60cd1 (diff) | |
download | gnunet-10cb56ae4e463e404d4d3ba2147340809d608ed8.tar.gz gnunet-10cb56ae4e463e404d4d3ba2147340809d608ed8.zip |
-minor optimization
Diffstat (limited to 'src/util/os_installation.c')
-rw-r--r-- | src/util/os_installation.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index e790ce10e..2e1acac64 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -520,16 +520,26 @@ GNUNET_OS_check_helper_binary (const char *binary) | |||
520 | return GNUNET_NO; | 520 | return GNUNET_NO; |
521 | #else | 521 | #else |
522 | GNUNET_free (p); | 522 | GNUNET_free (p); |
523 | rawsock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP); | ||
524 | if (INVALID_SOCKET == rawsock) | ||
525 | { | 523 | { |
526 | DWORD err = GetLastError (); | 524 | static int once; /* remember result from previous runs... */ |
527 | 525 | ||
528 | LOG (GNUNET_ERROR_TYPE_INFO, | 526 | if (0 == once) |
529 | "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) failed! GLE = %d\n", err); | 527 | { |
530 | return GNUNET_NO; /* not running as administrator */ | 528 | rawsock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP); |
531 | } | 529 | if (INVALID_SOCKET == rawsock) |
532 | closesocket (rawsock); | 530 | { |
531 | DWORD err = GetLastError (); | ||
532 | |||
533 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
534 | "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) failed! GLE = %d\n", err); | ||
535 | once = -1; | ||
536 | return GNUNET_NO; /* not running as administrator */ | ||
537 | } | ||
538 | once = 1; | ||
539 | closesocket (rawsock); | ||
540 | } | ||
541 | if (-1 == once) | ||
542 | return GNUNET_NO; | ||
533 | return GNUNET_YES; | 543 | return GNUNET_YES; |
534 | #endif | 544 | #endif |
535 | } | 545 | } |