GNUnet 0.22.2
disk.c File Reference

disk IO convenience methods More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "disk.h"
#include <sys/types.h>
Include dependency graph for disk.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_DISK_PipeHandle
 Handle used to manage a pipe. More...
 
struct  GetFileSizeData
 Closure for the recursion to determine the file size of a directory. More...
 
struct  GlobClosure
 
struct  GNUNET_DISK_MapHandle
 Handle for a memory-mapping operation. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "util-disk", __VA_ARGS__)
 
#define LOG_STRERROR(kind, syscall)    GNUNET_log_from_strerror (kind, "util-disk", syscall)
 
#define LOG_STRERROR_FILE(kind, syscall, filename)    GNUNET_log_from_strerror_file (kind, "util-disk", syscall, filename)
 
#define COPY_BLK_SIZE   65536
 Block size for IO for copying files. More...
 
#define _IFMT   0170000 /* type of file */
 
#define _IFLNK   0120000 /* symbolic link */
 
#define S_ISLNK(m)   (((m)&_IFMT) == _IFLNK)
 
#define MAP_FAILED   ((void *) -1)
 

Functions

static int translate_unix_perms (enum GNUNET_DISK_AccessPermissions perm)
 Translate GNUnet-internal permission bitmap to UNIX file access permission bitmap. More...
 
static enum GNUNET_GenericReturnValue get_size_rec (void *cls, const char *fn)
 Iterate over all files in the given directory and accumulate their size. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h)
 Checks whether a handle is invalid. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, off_t *size)
 Get the size of an open file. More...
 
off_t GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, off_t offset, enum GNUNET_DISK_Seek whence)
 Move the read/write pointer in a file. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_size (const char *filename, uint64_t *size, int include_symbolic_links, int single_file_mode)
 Get the size of the file (or directory) of the given file (in bytes). More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_get_identifiers (const char *filename, uint64_t *dev, uint64_t *ino)
 Obtain some unique identifiers for the given file that can be used to identify it in the local system. More...
 
static char * mktemp_name (const char *t)
 Create the name for a temporary file or directory from a template. More...
 
void GNUNET_DISK_fix_permissions (const char *fn, int require_uid_match, int require_gid_match)
 Update POSIX permissions mask of a file on disk. More...
 
char * GNUNET_DISK_mkdtemp (const char *t)
 Create an (empty) temporary directory on disk. More...
 
char * GNUNET_DISK_file_backup (const char *fil)
 Move a file out of the way (create a backup) by renaming it to "orig.NUM~" where NUM is the smallest number that is not used yet. More...
 
char * GNUNET_DISK_mktemp (const char *t)
 Create an (empty) temporary file on disk. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_test (const char *fil, int is_readable)
 Test if fil is a directory and listable. More...
 
static enum GNUNET_GenericReturnValue file_test_internal (const char *fil, int amode)
 Check if fil can be accessed using amode. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test (const char *fil)
 Check that fil corresponds to a filename (of a file that exists and that is not a directory). More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test_read (const char *fil)
 Check that fil corresponds to a filename and the file has read permissions. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create (const char *dir)
 Implementation of "mkdir -p". More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file (const char *filename)
 Create the directory structure for storing a file. More...
 
ssize_t GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
 Read the contents of a binary file into a buffer. More...
 
ssize_t GNUNET_DISK_fn_read (const char *fn, void *result, size_t len)
 Read the contents of a binary file into a buffer. More...
 
ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
 Write a buffer to a file. More...
 
ssize_t GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
 Write a buffer to a file, blocking, if necessary. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_fn_write (const char *fn, const void *buf, size_t buf_size, enum GNUNET_DISK_AccessPermissions mode)
 Write a buffer to a file atomically. More...
 
int GNUNET_DISK_directory_scan (const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
 Scan a directory for files. More...
 
static bool glob_match (const char *pattern, const char *str)
 Check for a simple wildcard match. More...
 
static enum GNUNET_GenericReturnValue glob_cb (void *cls, const char *filename)
 Function called with a filename. More...
 
int GNUNET_DISK_glob (const char *glob_pattern, GNUNET_FileNameCallback callback, void *callback_cls)
 Find all files matching a glob pattern. More...
 
static enum GNUNET_GenericReturnValue remove_helper (void *unused, const char *fn)
 Function that removes the given directory by calling GNUNET_DISK_directory_remove(). More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_remove (const char *filename)
 Remove all files in a directory (rm -rf). More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_copy (const char *src, const char *dst)
 Copy a file. More...
 
void GNUNET_DISK_filename_canonicalize (char *fn)
 Removes special characters as ':' from a filename. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_change_owner (const char *filename, const char *user)
 Change owner of a file. More...
 
struct GNUNET_DISK_FileHandleGNUNET_DISK_file_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
 Open a file. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h)
 Close an open file. More...
 
struct GNUNET_DISK_FileHandleGNUNET_DISK_get_handle_from_int_fd (int fno)
 Get a handle from a native integer FD. More...
 
struct GNUNET_DISK_FileHandleGNUNET_DISK_get_handle_from_native (FILE *fd)
 Get a handle from a native FD. More...
 
void * GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h, struct GNUNET_DISK_MapHandle **m, enum GNUNET_DISK_MapType access, size_t len)
 Map a file into memory. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h)
 Unmap a file. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h)
 Write file changes to disk. More...
 
struct GNUNET_DISK_PipeHandleGNUNET_DISK_pipe (enum GNUNET_DISK_PipeFlags pf)
 Creates an interprocess channel. More...
 
struct GNUNET_DISK_PipeHandleGNUNET_DISK_pipe_from_fd (enum GNUNET_DISK_PipeFlags pf, int fd[2])
 Creates a pipe object from a couple of file descriptors. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd end)
 Closes one half of an interprocess channel. More...
 
struct GNUNET_DISK_FileHandleGNUNET_DISK_pipe_detach_end (struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd end)
 Detaches one of the ends from the pipe. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p)
 Closes an interprocess channel. More...
 
const struct GNUNET_DISK_FileHandleGNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n)
 Get the handle to a particular pipe end. More...
 
enum GNUNET_GenericReturnValue GNUNET_DISK_internal_file_handle_ (const struct GNUNET_DISK_FileHandle *fh, int *dst)
 Retrieve OS file handle. More...
 
static enum GNUNET_GenericReturnValue purge_cfg_dir (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Helper function for GNUNET_DISK_purge_cfg_dir. More...
 
void GNUNET_DISK_purge_cfg_dir (const struct GNUNET_OS_ProjectData *pd, const char *cfg_filename, const char *option)
 Remove the directory given under option in section [PATHS] in configuration under cfg_filename. More...
 

Detailed Description

disk IO convenience methods

Author
Christian Grothoff
Nils Durner

Definition in file disk.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "util-disk", __VA_ARGS__)

Definition at line 31 of file disk.c.

◆ LOG_STRERROR

#define LOG_STRERROR (   kind,
  syscall 
)     GNUNET_log_from_strerror (kind, "util-disk", syscall)

Definition at line 33 of file disk.c.

◆ LOG_STRERROR_FILE

#define LOG_STRERROR_FILE (   kind,
  syscall,
  filename 
)     GNUNET_log_from_strerror_file (kind, "util-disk", syscall, filename)

Definition at line 36 of file disk.c.

◆ COPY_BLK_SIZE

#define COPY_BLK_SIZE   65536

Block size for IO for copying files.

Definition at line 42 of file disk.c.

◆ _IFMT

#define _IFMT   0170000 /* type of file */

Definition at line 59 of file disk.c.

◆ _IFLNK

#define _IFLNK   0120000 /* symbolic link */

Definition at line 60 of file disk.c.

◆ S_ISLNK

#define S_ISLNK (   m)    (((m)&_IFMT) == _IFLNK)

Definition at line 61 of file disk.c.

◆ MAP_FAILED

#define MAP_FAILED   ((void *) -1)

Definition at line 1375 of file disk.c.

Function Documentation

◆ translate_unix_perms()

static int translate_unix_perms ( enum GNUNET_DISK_AccessPermissions  perm)
static

Translate GNUnet-internal permission bitmap to UNIX file access permission bitmap.

Parameters
permfile permissions, GNUnet style
Returns
file permissions, UNIX style

Definition at line 109 of file disk.c.

110{
111 int mode;
112
113 mode = 0;
115 mode |= S_IRUSR;
117 mode |= S_IWUSR;
119 mode |= S_IXUSR;
121 mode |= S_IRGRP;
123 mode |= S_IWGRP;
125 mode |= S_IXGRP;
127 mode |= S_IROTH;
129 mode |= S_IWOTH;
131 mode |= S_IXOTH;
132
133 return mode;
134}
static enum @44 mode
Should we do a PUT (mode = 0) or GET (mode = 1);.
@ GNUNET_DISK_PERM_OTHER_EXEC
Everybody can execute.
@ GNUNET_DISK_PERM_USER_EXEC
Owner can execute.
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_GROUP_READ
Group can read.
@ GNUNET_DISK_PERM_GROUP_EXEC
Group can execute.
@ GNUNET_DISK_PERM_GROUP_WRITE
Group can write.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
@ GNUNET_DISK_PERM_OTHER_READ
Everybody can read.
@ GNUNET_DISK_PERM_OTHER_WRITE
Everybody can write.

References GNUNET_DISK_PERM_GROUP_EXEC, GNUNET_DISK_PERM_GROUP_READ, GNUNET_DISK_PERM_GROUP_WRITE, GNUNET_DISK_PERM_OTHER_EXEC, GNUNET_DISK_PERM_OTHER_READ, GNUNET_DISK_PERM_OTHER_WRITE, GNUNET_DISK_PERM_USER_EXEC, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, and mode.

Referenced by GNUNET_DISK_file_backup(), GNUNET_DISK_file_open(), and GNUNET_DISK_fn_write().

Here is the caller graph for this function:

◆ get_size_rec()

static enum GNUNET_GenericReturnValue get_size_rec ( void *  cls,
const char *  fn 
)
static

Iterate over all files in the given directory and accumulate their size.

Parameters
clsclosure of type struct GetFileSizeData
fncurrent filename we are looking at
Returns
GNUNET_SYSERR on serious errors, otherwise GNUNET_OK

Definition at line 146 of file disk.c.

147{
148 struct GetFileSizeData *gfsd = cls;
149
150#if defined(HAVE_STAT64) && \
151 ! (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64)
152 struct stat64 buf;
153
154 if (0 != lstat64 (fn, &buf))
155 {
157 return GNUNET_SYSERR;
158 }
159#else
160 struct stat buf;
161
162 if (0 != lstat (fn, &buf))
163 {
165 return GNUNET_SYSERR;
166 }
167#endif
168 if ((S_ISDIR (buf.st_mode)) && (gfsd->single_file_mode == GNUNET_YES))
169 {
170 errno = EISDIR;
171 return GNUNET_SYSERR;
172 }
173 if ((! S_ISLNK (buf.st_mode)) || (gfsd->include_sym_links == GNUNET_YES))
174 gfsd->total += buf.st_size;
175 if ((S_ISDIR (buf.st_mode)) && (0 == access (fn, X_OK)) &&
176 ((! S_ISLNK (buf.st_mode)) || (gfsd->include_sym_links == GNUNET_YES)))
177 {
179 return GNUNET_SYSERR;
180 }
181 return GNUNET_OK;
182}
static enum GNUNET_GenericReturnValue get_size_rec(void *cls, const char *fn)
Iterate over all files in the given directory and accumulate their size.
Definition: disk.c:146
#define LOG_STRERROR_FILE(kind, syscall, filename)
Definition: disk.c:36
#define S_ISLNK(m)
Definition: disk.c:61
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
Definition: disk.c:826
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_SYSERR
@ GNUNET_ERROR_TYPE_DEBUG
Closure for the recursion to determine the file size of a directory.
Definition: disk.c:83
uint64_t total
Set to the total file size.
Definition: disk.c:87
int include_sym_links
GNUNET_YES if symbolic links should be included.
Definition: disk.c:92
int single_file_mode
GNUNET_YES if mode is file-only (return total == -1 for directories).
Definition: disk.c:97

References get_size_rec(), GNUNET_DISK_directory_scan(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GetFileSizeData::include_sym_links, LOG_STRERROR_FILE, S_ISLNK, GetFileSizeData::single_file_mode, and GetFileSizeData::total.

Referenced by get_size_rec(), and GNUNET_DISK_file_size().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mktemp_name()

static char * mktemp_name ( const char *  t)
static

Create the name for a temporary file or directory from a template.

Parameters
ttemplate (without XXXXX or "/tmp/")
Returns
name ready for passing to 'mktemp' or 'mkdtemp', NULL on error

Definition at line 293 of file disk.c.

294{
295 const char *tmpdir;
296 char *tmpl;
297 char *fn;
298
299 if ((t[0] != '/') && (t[0] != '\\'))
300 {
301 /* FIXME: This uses system codepage on W32, not UTF-8 */
302 tmpdir = getenv ("TMPDIR");
303 if (NULL == tmpdir)
304 tmpdir = getenv ("TMP");
305 if (NULL == tmpdir)
306 tmpdir = getenv ("TEMP");
307 if (NULL == tmpdir)
308 tmpdir = "/tmp";
309 GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX");
310 }
311 else
312 {
313 GNUNET_asprintf (&tmpl, "%s%s", t, "XXXXXX");
314 }
315 fn = tmpl;
316 return fn;
317}
char * getenv()
static struct GNUNET_SCHEDULER_Task * t
Main task.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.

References getenv(), GNUNET_asprintf(), and t.

Referenced by GNUNET_DISK_mkdtemp(), and GNUNET_DISK_mktemp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ file_test_internal()

static enum GNUNET_GenericReturnValue file_test_internal ( const char *  fil,
int  amode 
)
static

Check if fil can be accessed using amode.

Parameters
filfile to check for
amodeaccess mode
Returns
GNUnet error code

Definition at line 481 of file disk.c.

482{
483 struct stat filestat;
484 int ret;
485 char *rdir;
486
488 if (rdir == NULL)
489 return GNUNET_SYSERR;
490
491 ret = stat (rdir, &filestat);
492 if (0 != ret)
493 {
494 if (errno != ENOENT)
495 {
497 GNUNET_free (rdir);
498 return GNUNET_SYSERR;
499 }
500 GNUNET_free (rdir);
501 return GNUNET_NO;
502 }
503 if (! S_ISREG (filestat.st_mode))
504 {
505 GNUNET_free (rdir);
506 return GNUNET_NO;
507 }
508 if (access (rdir, amode) < 0)
509 {
511 GNUNET_free (rdir);
512 return GNUNET_SYSERR;
513 }
514 GNUNET_free (rdir);
515 return GNUNET_YES;
516}
static int ret
Final status code.
Definition: gnunet-arm.c:93
@ GNUNET_NO
#define GNUNET_free(ptr)
Wrapper around free.
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition: strings.c:504

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_NO, GNUNET_STRINGS_filename_expand(), GNUNET_SYSERR, GNUNET_YES, LOG_STRERROR_FILE, and ret.

Referenced by GNUNET_DISK_file_test(), and GNUNET_DISK_file_test_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ glob_match()

static bool glob_match ( const char *  pattern,
const char *  str 
)
static

Check for a simple wildcard match.

Only asterisks are allowed. Asterisks match everything, including slashes.

Parameters
patternpattern with wildcards
strstring to match against
Returns
true on match, false otherwise

Definition at line 910 of file disk.c.

911{
912 /* Position in the input string */
913 const char *str_pos = str;
914 /* Position in the pattern */
915 const char *pat_pos = pattern;
916 /* Backtrack position in string */
917 const char *str_bt = NULL;
918 /* Backtrack position in pattern */
919 const char *pat_bt = NULL;
920
921 for (;;)
922 {
923 if (*pat_pos == '*')
924 {
925 str_bt = str_pos;
926 pat_bt = pat_pos++;
927 }
928 else if (*pat_pos == *str_pos)
929 {
930 if ('\0' == *pat_pos)
931 return true;
932 str_pos++;
933 pat_pos++;
934 }
935 else
936 {
937 if (NULL == str_bt)
938 return false;
939 /* Backtrack to match one more
940 character as part of the asterisk. */
941 str_pos = str_bt + 1;
942 if ('\0' == *str_pos)
943 return false;
944 pat_pos = pat_bt;
945 }
946 }
947}

Referenced by glob_cb().

Here is the caller graph for this function:

◆ glob_cb()

static enum GNUNET_GenericReturnValue glob_cb ( void *  cls,
const char *  filename 
)
static

Function called with a filename.

Parameters
clsclosure
filenamecomplete filename (absolute path)
Returns
GNUNET_OK to continue to iterate, GNUNET_NO to stop iteration with no error, GNUNET_SYSERR to abort iteration with error!

Definition at line 972 of file disk.c.

974{
975 struct GlobClosure *gc = cls;
976 const char *fn;
977
978 fn = strrchr (filename, DIR_SEPARATOR);
979 fn = (NULL == fn) ? filename : (fn + 1);
980
982 "checking glob '%s' against '%s'\n",
983 gc->glob,
984 fn);
985
986 if (glob_match (gc->glob, fn))
987 {
988 enum GNUNET_GenericReturnValue cbret;
989
991 "found glob match '%s'\n",
992 filename);
993 gc->nres++;
994 cbret = gc->cb (gc->cls, filename);
995 if (GNUNET_OK != cbret)
996 return cbret;
997 }
998 return GNUNET_OK;
999}
static bool glob_match(const char *pattern, const char *str)
Check for a simple wildcard match.
Definition: disk.c:910
#define LOG(kind,...)
Definition: disk.c:31
static char * filename
GNUNET_GenericReturnValue
Named constants for return values.
#define DIR_SEPARATOR
Definition: platform.h:166
GNUNET_FileNameCallback cb
Definition: disk.c:953
void * cls
Definition: disk.c:954
int nres
Number of files that actually matched the glob pattern.
Definition: disk.c:959
const char * glob
Definition: disk.c:952

References GlobClosure::cb, GlobClosure::cls, DIR_SEPARATOR, filename, GlobClosure::glob, glob_match(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_OK, LOG, and GlobClosure::nres.

Referenced by GNUNET_DISK_glob().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_helper()

static enum GNUNET_GenericReturnValue remove_helper ( void *  unused,
const char *  fn 
)
static

Function that removes the given directory by calling GNUNET_DISK_directory_remove().

Parameters
unusednot used
fndirectory to remove
Returns
GNUNET_OK

Definition at line 1070 of file disk.c.

1072{
1073 (void) unused;
1074 (void) GNUNET_DISK_directory_remove (fn);
1075 return GNUNET_OK;
1076}
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_remove(const char *filename)
Remove all files in a directory (rm -rf).
Definition: disk.c:1080

References GNUNET_DISK_directory_remove(), and GNUNET_OK.

Referenced by GNUNET_DISK_directory_remove().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_DISK_internal_file_handle_()

enum GNUNET_GenericReturnValue GNUNET_DISK_internal_file_handle_ ( const struct GNUNET_DISK_FileHandle fh,
int *  dst 
)

Retrieve OS file handle.

Parameters
fhGNUnet file descriptor
dstdestination buffer
Returns
GNUNET_OK on success, GNUNET_SYSERR otherwise

Definition at line 1638 of file disk.c.

1640{
1641 if (NULL == fh)
1642 return GNUNET_SYSERR;
1643 *dst = fh->fd;
1644 return GNUNET_OK;
1645}
int fd
File handle on Unix-like systems.

References GNUNET_DISK_FileHandle::fd, GNUNET_OK, and GNUNET_SYSERR.

Referenced by GNUNET_NETWORK_fdset_handle_set(), and start_process().

Here is the caller graph for this function:

◆ purge_cfg_dir()

static enum GNUNET_GenericReturnValue purge_cfg_dir ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Helper function for GNUNET_DISK_purge_cfg_dir.

Parameters
clsa const char * with the option to purge
cfgour configuration
Returns
GNUNET_OK on success

Definition at line 1656 of file disk.c.

1658{
1659 const char *option = cls;
1660 char *tmpname;
1661
1662 if (GNUNET_OK !=
1664 "PATHS",
1665 option,
1666 &tmpname))
1667 {
1669 "PATHS",
1670 option);
1671 return GNUNET_NO;
1672 }
1673 if (GNUNET_SYSERR ==
1675 {
1677 "remove",
1678 tmpname);
1679 GNUNET_free (tmpname);
1680 return GNUNET_OK;
1681 }
1682 GNUNET_free (tmpname);
1683 return GNUNET_OK;
1684}
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_ERROR

References cfg, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_DISK_directory_remove(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log_config_missing(), GNUNET_log_strerror_file, GNUNET_NO, GNUNET_OK, and GNUNET_SYSERR.

Referenced by GNUNET_DISK_purge_cfg_dir().

Here is the call graph for this function:
Here is the caller graph for this function: