aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/disk.c5
-rw-r--r--src/util/disk.h17
-rw-r--r--src/util/network.c4
3 files changed, 20 insertions, 6 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index 46a71b48f..07b25674e 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1747,8 +1747,9 @@ GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p,
1747 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 1747 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
1748 */ 1748 */
1749int 1749int
1750GNUNET_internal_disk_file_handle (const struct GNUNET_DISK_FileHandle *fh, 1750GNUNET_DISK_internal_file_handle_ (const struct GNUNET_DISK_FileHandle *fh,
1751 void *dst, unsigned int dst_len) 1751 void *dst,
1752 size_t dst_len)
1752{ 1753{
1753#ifdef MINGW 1754#ifdef MINGW
1754 if (dst_len < sizeof (HANDLE)) 1755 if (dst_len < sizeof (HANDLE))
diff --git a/src/util/disk.h b/src/util/disk.h
index 17ebe4a0a..96324e120 100644
--- a/src/util/disk.h
+++ b/src/util/disk.h
@@ -30,15 +30,27 @@
30 30
31#include "gnunet_disk_lib.h" 31#include "gnunet_disk_lib.h"
32 32
33
34/**
35 * Handle used to access files (and pipes).
36 */
33struct GNUNET_DISK_FileHandle 37struct GNUNET_DISK_FileHandle
34{ 38{
35#ifdef MINGW 39#ifdef MINGW
40 /**
41 * File handle under W32.
42 */
36 HANDLE h; 43 HANDLE h;
37#else 44#else
45 /**
46 * File handle on other OSes.
47 */
38 int fd; 48 int fd;
39#endif 49#endif
40}; 50};
41 51
52
53
42/** 54/**
43 * Retrieve OS file handle 55 * Retrieve OS file handle
44 * 56 *
@@ -48,7 +60,8 @@ struct GNUNET_DISK_FileHandle
48 * @param dst_len length of dst 60 * @param dst_len length of dst
49 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 61 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
50 */ 62 */
51int GNUNET_internal_disk_file_handle (const struct GNUNET_DISK_FileHandle *fh, 63int GNUNET_DISK_internal_file_handle_ (const struct GNUNET_DISK_FileHandle *fh,
52 void *dst, unsigned int dst_len); 64 void *dst,
65 size_t dst_len);
53 66
54#endif /* GNUNET_DISK_H_ */ 67#endif /* GNUNET_DISK_H_ */
diff --git a/src/util/network.c b/src/util/network.c
index 2278ae34b..c10317258 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -527,12 +527,12 @@ GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
527#ifdef MINGW 527#ifdef MINGW
528 HANDLE hw; 528 HANDLE hw;
529 529
530 GNUNET_internal_disk_file_handle (h, &hw, sizeof (HANDLE)); 530 GNUNET_DISK_internal_file_handle_ (h, &hw, sizeof (HANDLE));
531 GNUNET_CONTAINER_slist_add (fds->handles, GNUNET_NO, &hw, sizeof (HANDLE)); 531 GNUNET_CONTAINER_slist_add (fds->handles, GNUNET_NO, &hw, sizeof (HANDLE));
532#else 532#else
533 int fd; 533 int fd;
534 534
535 GNUNET_internal_disk_file_handle (h, &fd, sizeof (int)); 535 GNUNET_DISK_internal_file_handle_ (h, &fd, sizeof (int));
536 FD_SET (fd, &fds->sds); 536 FD_SET (fd, &fds->sds);
537 if (fd + 1 > fds->nsds) 537 if (fd + 1 > fds->nsds)
538 fds->nsds = fd + 1; 538 fds->nsds = fd + 1;