diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk_common.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk_common.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/fs/gnunet-fs-gtk_common.c b/src/fs/gnunet-fs-gtk_common.c index af9284bc..90077f52 100644 --- a/src/fs/gnunet-fs-gtk_common.c +++ b/src/fs/gnunet-fs-gtk_common.c | |||
@@ -192,8 +192,9 @@ GNUNET_FS_GTK_get_thumbnail_from_meta_data (const struct | |||
192 | * @param filename name with the directory | 192 | * @param filename name with the directory |
193 | * @param dep function to call on each entry | 193 | * @param dep function to call on each entry |
194 | * @param dep_cls closure for 'dep' | 194 | * @param dep_cls closure for 'dep' |
195 | * @return GNUNET_OK on success | ||
195 | */ | 196 | */ |
196 | void | 197 | int |
197 | GNUNET_FS_GTK_mmap_and_scan (const char *filename, | 198 | GNUNET_FS_GTK_mmap_and_scan (const char *filename, |
198 | GNUNET_FS_DirectoryEntryProcessor dep, | 199 | GNUNET_FS_DirectoryEntryProcessor dep, |
199 | void *dep_cls) | 200 | void *dep_cls) |
@@ -202,23 +203,24 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename, | |||
202 | struct GNUNET_DISK_MapHandle *mh; | 203 | struct GNUNET_DISK_MapHandle *mh; |
203 | uint64_t fsize; | 204 | uint64_t fsize; |
204 | void *ddata; | 205 | void *ddata; |
206 | int ret; | ||
205 | 207 | ||
206 | if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fsize, GNUNET_YES)) | 208 | if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fsize, GNUNET_YES)) |
207 | { | 209 | { |
208 | GNUNET_break (0); | 210 | GNUNET_break (0); |
209 | return; | 211 | return GNUNET_SYSERR; |
210 | } | 212 | } |
211 | if (NULL == (fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, | 213 | if (NULL == (fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, |
212 | GNUNET_DISK_PERM_NONE))) | 214 | GNUNET_DISK_PERM_NONE))) |
213 | { | 215 | { |
214 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename); | 216 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename); |
215 | return; | 217 | return GNUNET_SYSERR; |
216 | } | 218 | } |
217 | if (NULL == (ddata = GNUNET_DISK_file_map (fh, &mh, GNUNET_DISK_MAP_TYPE_READ, (size_t) fsize))) | 219 | if (NULL == (ddata = GNUNET_DISK_file_map (fh, &mh, GNUNET_DISK_MAP_TYPE_READ, (size_t) fsize))) |
218 | { | 220 | { |
219 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "mmap", filename); | 221 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "mmap", filename); |
220 | GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh)); | 222 | GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh)); |
221 | return; | 223 | return GNUNET_SYSERR; |
222 | } | 224 | } |
223 | if (GNUNET_SYSERR == | 225 | if (GNUNET_SYSERR == |
224 | GNUNET_FS_directory_list_contents ((size_t) fsize, ddata, 0, dep, | 226 | GNUNET_FS_directory_list_contents ((size_t) fsize, ddata, 0, dep, |
@@ -226,9 +228,15 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename, | |||
226 | { | 228 | { |
227 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 229 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
228 | _("Selected file `%s' is not a GNUnet directory!\n"), filename); | 230 | _("Selected file `%s' is not a GNUnet directory!\n"), filename); |
231 | ret = GNUNET_SYSERR; | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | ret = GNUNET_OK; | ||
229 | } | 236 | } |
230 | GNUNET_break (GNUNET_OK == GNUNET_DISK_file_unmap (mh)); | 237 | GNUNET_break (GNUNET_OK == GNUNET_DISK_file_unmap (mh)); |
231 | GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh)); | 238 | GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh)); |
239 | return ret; | ||
232 | } | 240 | } |
233 | 241 | ||
234 | 242 | ||