aboutsummaryrefslogtreecommitdiff
path: root/src/util/disk.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-09 17:33:04 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-09 17:33:04 +0200
commit8bb475af99260f1d107dbc8908268ae93960aa83 (patch)
tree1a7a1fc03424df841a6f977b137482439b09bc9f /src/util/disk.c
parent1f80a11e90ee982bffaae4685e281f75ee1c225d (diff)
downloadgnunet-8bb475af99260f1d107dbc8908268ae93960aa83.tar.gz
gnunet-8bb475af99260f1d107dbc8908268ae93960aa83.zip
implement new functions in libgnunetsq, clean up sqlite namestore plugin, implement flow control in namestore API and tests
Diffstat (limited to 'src/util/disk.c')
-rw-r--r--src/util/disk.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index 8fd689070..37d689576 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2001--2013, 2016 GNUnet e.V. 3 Copyright (C) 2001--2013, 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -2641,4 +2641,55 @@ GNUNET_DISK_internal_file_handle_ (const struct GNUNET_DISK_FileHandle *fh,
2641 return GNUNET_OK; 2641 return GNUNET_OK;
2642} 2642}
2643 2643
2644
2645/**
2646 * Remove the directory given under @a option in
2647 * section [PATHS] in configuration under @a cfg_filename
2648 *
2649 * @param cfg_filename configuration file to parse
2650 * @param option option with the dir name to purge
2651 */
2652void
2653GNUNET_DISK_purge_cfg_dir (const char *cfg_filename,
2654 const char *option)
2655{
2656 struct GNUNET_CONFIGURATION_Handle *cfg;
2657 char *tmpname;
2658
2659 cfg = GNUNET_CONFIGURATION_create ();
2660 if (GNUNET_OK !=
2661 GNUNET_CONFIGURATION_load (cfg,
2662 cfg_filename))
2663 {
2664 GNUNET_break (0);
2665 GNUNET_CONFIGURATION_destroy (cfg);
2666 return;
2667 }
2668 if (GNUNET_OK !=
2669 GNUNET_CONFIGURATION_get_value_filename (cfg,
2670 "PATHS",
2671 option,
2672 &tmpname))
2673 {
2674 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
2675 "PATHS",
2676 option);
2677 GNUNET_CONFIGURATION_destroy (cfg);
2678 return;
2679 }
2680 GNUNET_CONFIGURATION_destroy (cfg);
2681 if (GNUNET_SYSERR ==
2682 GNUNET_DISK_directory_remove (tmpname))
2683 {
2684 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
2685 "remove",
2686 tmpname);
2687 GNUNET_free (tmpname);
2688 return;
2689 }
2690 GNUNET_free (tmpname);
2691}
2692
2693
2694
2644/* end of disk.c */ 2695/* end of disk.c */