From: Christian Grothoff Date: Mon, 9 Jan 2012 16:38:26 +0000 (+0000) Subject: LRN: make disk iterator start return GNUNET_SYSERR if run on empty directory X-Git-Tag: initial-import-from-subversion-38251~15365 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c4829724c001815fd57fc2f1d44c7815602196ec;p=oweals%2Fgnunet.git LRN: make disk iterator start return GNUNET_SYSERR if run on empty directory --- diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index 19c1328bd..fc2f01704 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h @@ -565,8 +565,10 @@ GNUNET_DISK_directory_iterator_next (struct GNUNET_DISK_DirectoryIterator *iter, * @param dirName the name of the directory * @param callback the method to call for each file * @param callback_cls closure for callback + * @return GNUNET_YES if directory is not empty and @callback + * will be called later, GNUNET_NO otherwise, GNUNET_SYSERR on error. */ -void +int GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio, const char *dirName, GNUNET_DISK_DirectoryIteratorCallback diff --git a/src/util/disk.c b/src/util/disk.c index e6b542adf..430d9cc46 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -1047,8 +1047,10 @@ GNUNET_DISK_directory_iterator_next (struct GNUNET_DISK_DirectoryIterator *iter, * @param dirName the name of the directory * @param callback the method to call for each file * @param callback_cls closure for callback + * @return GNUNET_YES if directory is not empty and @callback + * will be called later, GNUNET_NO otherwise, GNUNET_SYSERR on error. */ -void +int GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio, const char *dirName, GNUNET_DISK_DirectoryIteratorCallback @@ -1064,11 +1066,11 @@ GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio, { GNUNET_free (di); callback (callback_cls, NULL, NULL, NULL); - return; + return GNUNET_SYSERR; } di->dirname = GNUNET_strdup (dirName); di->priority = prio; - GNUNET_DISK_directory_iterator_next (di, GNUNET_NO); + return GNUNET_DISK_directory_iterator_next (di, GNUNET_NO); }