diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2009-07-05 21:13:39 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2009-07-05 21:13:39 +0000 |
commit | 2f739eb49d9f1148c1da9b44dc6966421fcd5ddc (patch) | |
tree | fe50431510d91a4f76c73d858d0e4c577998a47d /src/util | |
parent | 800ce6a9af392dba292a3e00185c553d9764e2c8 (diff) |
fixing segv under linux due to unused w32-specific handle being dereferenced on unmap
git-svn-id: https://gnunet.org/svn/gnunet@8629 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/disk.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/util/disk.c b/src/util/disk.c index a7e4a08658..0192786837 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -1243,7 +1243,7 @@ GNUNET_DISK_file_map (const struct GNUNET_IO_Handle *h, struct GNUNET_IO_Handle return NULL; } - *m = (struct GNUNET_IO_Handle *) GNUNET_malloc (sizeof (struct GNUNET_IO_Handle)); + *m = GNUNET_malloc (sizeof (struct GNUNET_IO_Handle)); (*m)->h = CreateFileMapping (h->h, NULL, protect, 0, 0, NULL); if ((*m)->h == INVALID_HANDLE_VALUE) { @@ -1269,7 +1269,7 @@ GNUNET_DISK_file_map (const struct GNUNET_IO_Handle *h, struct GNUNET_IO_Handle prot = PROT_READ; if (access & GNUNET_DISK_MAP_WRITE) prot |= PROT_WRITE; - + *m = NULL; return mmap (NULL, len, prot, MAP_SHARED, h->fd, 0); #endif } @@ -1287,7 +1287,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_IO_Handle **h, void *addr, size_t len) #ifdef MINGW int ret; - if (h == NULL || *h == NULL) + if ( (h == NULL) || (*h == NULL) ) { errno = EINVAL; return GNUNET_SYSERR; @@ -1308,10 +1308,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_IO_Handle **h, void *addr, size_t len) return ret; #else - int ret; - ret = munmap (addr, len) != -1 ? GNUNET_OK : GNUNET_SYSERR; - GNUNET_DISK_handle_invalidate (*h); - return ret; + return munmap (addr, len) != -1 ? GNUNET_OK : GNUNET_SYSERR; #endif } |