aboutsummaryrefslogtreecommitdiff
path: root/src/util/disk.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-22 21:47:42 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-22 21:47:42 +0200
commit8703a0516f92819ea97d991984540332c061fe17 (patch)
tree338da09bb4f4f3f280e2ed7cbcc8698b9cb870de /src/util/disk.c
parent422e7a0319bbb6e8ae87d5d37ed5674b4daf1bcb (diff)
downloadgnunet-8703a0516f92819ea97d991984540332c061fe17.tar.gz
gnunet-8703a0516f92819ea97d991984540332c061fe17.zip
ensure psql fails hard if there is an error in the SQL (fixes #6437)
Diffstat (limited to 'src/util/disk.c')
-rw-r--r--src/util/disk.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index 6560726ea..c95e9753c 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1377,14 +1377,13 @@ GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h,
1377 enum GNUNET_DISK_MapType access, 1377 enum GNUNET_DISK_MapType access,
1378 size_t len) 1378 size_t len)
1379{ 1379{
1380 int prot;
1381
1380 if (NULL == h) 1382 if (NULL == h)
1381 { 1383 {
1382 errno = EINVAL; 1384 errno = EINVAL;
1383 return NULL; 1385 return NULL;
1384 } 1386 }
1385
1386 int prot;
1387
1388 prot = 0; 1387 prot = 0;
1389 if (access & GNUNET_DISK_MAP_TYPE_READ) 1388 if (access & GNUNET_DISK_MAP_TYPE_READ)
1390 prot = PROT_READ; 1389 prot = PROT_READ;
@@ -1405,22 +1404,21 @@ GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h,
1405 1404
1406/** 1405/**
1407 * Unmap a file 1406 * Unmap a file
1407 *
1408 * @param h mapping handle 1408 * @param h mapping handle
1409 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 1409 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
1410 */ 1410 */
1411int 1411int
1412GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h) 1412GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h)
1413{ 1413{
1414 int ret; 1414 int ret;
1415 1415
1416 if (h == NULL) 1416 if (NULL == h)
1417 { 1417 {
1418 errno = EINVAL; 1418 errno = EINVAL;
1419 return GNUNET_SYSERR; 1419 return GNUNET_SYSERR;
1420 } 1420 }
1421
1422 ret = munmap (h->addr, h->len) != -1 ? GNUNET_OK : GNUNET_SYSERR; 1421 ret = munmap (h->addr, h->len) != -1 ? GNUNET_OK : GNUNET_SYSERR;
1423
1424 GNUNET_free (h); 1422 GNUNET_free (h);
1425 return ret; 1423 return ret;
1426} 1424}
@@ -1429,7 +1427,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h)
1429/** 1427/**
1430 * Write file changes to disk 1428 * Write file changes to disk
1431 * @param h handle to an open file 1429 * @param h handle to an open file
1432 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 1430 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
1433 */ 1431 */
1434int 1432int
1435GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h) 1433GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h)