aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_file_information.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-22 18:34:29 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-22 18:34:29 +0000
commite483ac2a2c8eab6d5cc915c2f54ab2c27c469821 (patch)
tree0cdd2d9b3cc4fc62b085fb2f71103a100313448e /src/fs/fs_file_information.c
parent3a04f1fdf2882b96608e164babcd34dbcb2ad777 (diff)
downloadgnunet-e483ac2a2c8eab6d5cc915c2f54ab2c27c469821.tar.gz
gnunet-e483ac2a2c8eab6d5cc915c2f54ab2c27c469821.zip
LRN: two directory patches change the way "is_directory" is evaluated.
Now it must be GNUNET_YES for the execution flow to switch to a branch where something is considered to be a directory. The reason for that is that some functions might return GNUNET_SYSERR when asked whether something is a directory or not. Checking this value as "!= GNUNET_NO" will produce positive result, even though it's not a directory.
Diffstat (limited to 'src/fs/fs_file_information.c')
-rw-r--r--src/fs/fs_file_information.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index a633dcb7b..85a076fee 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -324,7 +324,7 @@ int
324GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, 324GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir,
325 struct GNUNET_FS_FileInformation *ent) 325 struct GNUNET_FS_FileInformation *ent)
326{ 326{
327 if ((ent->dir != NULL) || (ent->next != NULL) || (!dir->is_directory)) 327 if ((ent->dir != NULL) || (ent->next != NULL) || (dir->is_directory != GNUNET_YES))
328 { 328 {
329 GNUNET_break (0); 329 GNUNET_break (0);
330 return GNUNET_SYSERR; 330 return GNUNET_SYSERR;
@@ -362,12 +362,12 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir,
362 no = GNUNET_NO; 362 no = GNUNET_NO;
363 if (GNUNET_OK != 363 if (GNUNET_OK !=
364 proc (proc_cls, dir, 364 proc (proc_cls, dir,
365 (dir->is_directory) ? dir->data.dir.dir_size : dir->data. 365 (dir->is_directory == GNUNET_YES) ? dir->data.dir.dir_size : dir->data.
366 file.file_size, dir->meta, &dir->keywords, &dir->bo, 366 file.file_size, dir->meta, &dir->keywords, &dir->bo,
367 (dir->is_directory) ? &no : &dir->data.file.do_index, 367 (dir->is_directory == GNUNET_YES) ? &no : &dir->data.file.do_index,
368 &dir->client_info)) 368 &dir->client_info))
369 return; 369 return;
370 if (!dir->is_directory) 370 if (dir->is_directory != GNUNET_YES)
371 return; 371 return;
372 pos = dir->data.dir.entries; 372 pos = dir->data.dir.entries;
373 while (pos != NULL) 373 while (pos != NULL)
@@ -375,9 +375,9 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir,
375 no = GNUNET_NO; 375 no = GNUNET_NO;
376 if (GNUNET_OK != 376 if (GNUNET_OK !=
377 proc (proc_cls, pos, 377 proc (proc_cls, pos,
378 (pos->is_directory) ? pos->data.dir.dir_size : pos->data. 378 (pos->is_directory == GNUNET_YES) ? pos->data.dir.dir_size : pos->data.
379 file.file_size, pos->meta, &pos->keywords, &pos->bo, 379 file.file_size, pos->meta, &pos->keywords, &pos->bo,
380 (pos->is_directory) ? &no : &pos->data.file.do_index, 380 (pos->is_directory == GNUNET_YES) ? &no : &pos->data.file.do_index,
381 &pos->client_info)) 381 &pos->client_info))
382 break; 382 break;
383 pos = pos->next; 383 pos = pos->next;
@@ -404,7 +404,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
404 int no; 404 int no;
405 405
406 no = GNUNET_NO; 406 no = GNUNET_NO;
407 if (fi->is_directory) 407 if (fi->is_directory == GNUNET_YES)
408 { 408 {
409 /* clean up directory */ 409 /* clean up directory */
410 while (NULL != (pos = fi->data.dir.entries)) 410 while (NULL != (pos = fi->data.dir.entries))