diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-07-05 21:13:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-07-05 21:13:39 +0000 |
commit | 0619b171c1bd2b64af515673aa10b7f189d6068e (patch) | |
tree | fe50431510d91a4f76c73d858d0e4c577998a47d /src/util/disk.c | |
parent | 337fb5a2d19d239c38663cfd128e5d977388dfe9 (diff) | |
download | gnunet-0619b171c1bd2b64af515673aa10b7f189d6068e.tar.gz gnunet-0619b171c1bd2b64af515673aa10b7f189d6068e.zip |
fixing segv under linux due to unused w32-specific handle being dereferenced on unmap
Diffstat (limited to 'src/util/disk.c')
-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 a7e4a0865..019278683 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 | |||
1243 | return NULL; | 1243 | return NULL; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | *m = (struct GNUNET_IO_Handle *) GNUNET_malloc (sizeof (struct GNUNET_IO_Handle)); | 1246 | *m = GNUNET_malloc (sizeof (struct GNUNET_IO_Handle)); |
1247 | (*m)->h = CreateFileMapping (h->h, NULL, protect, 0, 0, NULL); | 1247 | (*m)->h = CreateFileMapping (h->h, NULL, protect, 0, 0, NULL); |
1248 | if ((*m)->h == INVALID_HANDLE_VALUE) | 1248 | if ((*m)->h == INVALID_HANDLE_VALUE) |
1249 | { | 1249 | { |
@@ -1269,7 +1269,7 @@ GNUNET_DISK_file_map (const struct GNUNET_IO_Handle *h, struct GNUNET_IO_Handle | |||
1269 | prot = PROT_READ; | 1269 | prot = PROT_READ; |
1270 | if (access & GNUNET_DISK_MAP_WRITE) | 1270 | if (access & GNUNET_DISK_MAP_WRITE) |
1271 | prot |= PROT_WRITE; | 1271 | prot |= PROT_WRITE; |
1272 | 1272 | *m = NULL; | |
1273 | return mmap (NULL, len, prot, MAP_SHARED, h->fd, 0); | 1273 | return mmap (NULL, len, prot, MAP_SHARED, h->fd, 0); |
1274 | #endif | 1274 | #endif |
1275 | } | 1275 | } |
@@ -1287,7 +1287,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_IO_Handle **h, void *addr, size_t len) | |||
1287 | #ifdef MINGW | 1287 | #ifdef MINGW |
1288 | int ret; | 1288 | int ret; |
1289 | 1289 | ||
1290 | if (h == NULL || *h == NULL) | 1290 | if ( (h == NULL) || (*h == NULL) ) |
1291 | { | 1291 | { |
1292 | errno = EINVAL; | 1292 | errno = EINVAL; |
1293 | return GNUNET_SYSERR; | 1293 | return GNUNET_SYSERR; |
@@ -1308,10 +1308,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_IO_Handle **h, void *addr, size_t len) | |||
1308 | 1308 | ||
1309 | return ret; | 1309 | return ret; |
1310 | #else | 1310 | #else |
1311 | int ret; | 1311 | return munmap (addr, len) != -1 ? GNUNET_OK : GNUNET_SYSERR; |
1312 | ret = munmap (addr, len) != -1 ? GNUNET_OK : GNUNET_SYSERR; | ||
1313 | GNUNET_DISK_handle_invalidate (*h); | ||
1314 | return ret; | ||
1315 | #endif | 1312 | #endif |
1316 | } | 1313 | } |
1317 | 1314 | ||