aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-09 16:38:26 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-09 16:38:26 +0000
commitc4829724c001815fd57fc2f1d44c7815602196ec (patch)
treeeb858a95c13b89337676eba57f4bab394a9ec3e7
parent7bbfa7f0bc69be2754e747a57fe5474d8bcdb9ec (diff)
downloadgnunet-c4829724c001815fd57fc2f1d44c7815602196ec.tar.gz
gnunet-c4829724c001815fd57fc2f1d44c7815602196ec.zip
LRN: make disk iterator start return GNUNET_SYSERR if run on empty directory
-rw-r--r--src/include/gnunet_disk_lib.h4
-rw-r--r--src/util/disk.c8
2 files changed, 8 insertions, 4 deletions
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,
565 * @param dirName the name of the directory 565 * @param dirName the name of the directory
566 * @param callback the method to call for each file 566 * @param callback the method to call for each file
567 * @param callback_cls closure for callback 567 * @param callback_cls closure for callback
568 * @return GNUNET_YES if directory is not empty and @callback
569 * will be called later, GNUNET_NO otherwise, GNUNET_SYSERR on error.
568 */ 570 */
569void 571int
570GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio, 572GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio,
571 const char *dirName, 573 const char *dirName,
572 GNUNET_DISK_DirectoryIteratorCallback 574 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,
1047 * @param dirName the name of the directory 1047 * @param dirName the name of the directory
1048 * @param callback the method to call for each file 1048 * @param callback the method to call for each file
1049 * @param callback_cls closure for callback 1049 * @param callback_cls closure for callback
1050 * @return GNUNET_YES if directory is not empty and @callback
1051 * will be called later, GNUNET_NO otherwise, GNUNET_SYSERR on error.
1050 */ 1052 */
1051void 1053int
1052GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio, 1054GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio,
1053 const char *dirName, 1055 const char *dirName,
1054 GNUNET_DISK_DirectoryIteratorCallback 1056 GNUNET_DISK_DirectoryIteratorCallback
@@ -1064,11 +1066,11 @@ GNUNET_DISK_directory_iterator_start (enum GNUNET_SCHEDULER_Priority prio,
1064 { 1066 {
1065 GNUNET_free (di); 1067 GNUNET_free (di);
1066 callback (callback_cls, NULL, NULL, NULL); 1068 callback (callback_cls, NULL, NULL, NULL);
1067 return; 1069 return GNUNET_SYSERR;
1068 } 1070 }
1069 di->dirname = GNUNET_strdup (dirName); 1071 di->dirname = GNUNET_strdup (dirName);
1070 di->priority = prio; 1072 di->priority = prio;
1071 GNUNET_DISK_directory_iterator_next (di, GNUNET_NO); 1073 return GNUNET_DISK_directory_iterator_next (di, GNUNET_NO);
1072} 1074}
1073 1075
1074 1076