gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21612 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r21612 - gnunet/src/fs
Date: Mon, 28 May 2012 11:55:08 +0200

Author: grothoff
Date: 2012-05-28 11:55:08 +0200 (Mon, 28 May 2012)
New Revision: 21612

Modified:
   gnunet/src/fs/fs_dirmetascan.c
   gnunet/src/fs/gnunet-helper-fs-publish.c
Log:
-fixing #2365

Modified: gnunet/src/fs/fs_dirmetascan.c
===================================================================
--- gnunet/src/fs/fs_dirmetascan.c      2012-05-27 22:38:45 UTC (rev 21611)
+++ gnunet/src/fs/fs_dirmetascan.c      2012-05-28 09:55:08 UTC (rev 21612)
@@ -309,7 +309,7 @@
   case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR:
     break;
   case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE:
-    if (filename[left-1] != '\0')
+    if ('\0' != filename[left-1])
       break;
     ds->progress_callback (ds->progress_callback_cls, 
                           filename, GNUNET_SYSERR,

Modified: gnunet/src/fs/gnunet-helper-fs-publish.c
===================================================================
--- gnunet/src/fs/gnunet-helper-fs-publish.c    2012-05-27 22:38:45 UTC (rev 
21611)
+++ gnunet/src/fs/gnunet-helper-fs-publish.c    2012-05-28 09:55:08 UTC (rev 
21612)
@@ -210,7 +210,8 @@
  * the scan.  Does NOT yet add any metadata.
  *
  * @param filename file or directory to scan
- * @param dst where to store the resulting share tree item
+ * @param dst where to store the resulting share tree item;
+ *         NULL is stored in 'dst' upon recoverable errors (GNUNET_OK is 
returned)
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 static int
@@ -258,6 +259,8 @@
     rc->stop = GNUNET_YES;
     return GNUNET_SYSERR;
   }
+  if (NULL == chld)
+    return GNUNET_OK;
   chld->parent = rc->parent;
   GNUNET_CONTAINER_DLL_insert (rc->parent->children_head,
                               rc->parent->children_tail,
@@ -272,7 +275,8 @@
  * the scan.  Does NOT yet add any metadata.
  *
  * @param filename file or directory to scan
- * @param dst where to store the resulting share tree item
+ * @param dst where to store the resulting share tree item;
+ *         NULL is stored in 'dst' upon recoverable errors (GNUNET_OK is 
returned) 
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 static int
@@ -293,6 +297,8 @@
        write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_SKIP_FILE,
                       filename, strlen (filename) + 1))
       return GNUNET_SYSERR;
+    /* recoverable error, store 'NULL' in *dst */
+    *dst = NULL;
     return GNUNET_OK;
   }
 
@@ -307,7 +313,7 @@
   item->filename = GNUNET_strdup (filename);
   item->is_directory = (S_ISDIR (sbuf.st_mode)) ? GNUNET_YES : GNUNET_NO;
   item->file_size = fsize;
-  if (item->is_directory == GNUNET_YES)
+  if (GNUNET_YES == item->is_directory)
   {
     struct RecursionContext rc;
 
@@ -316,7 +322,7 @@
     GNUNET_DISK_directory_scan (filename, 
                                &scan_callback, 
                                &rc);    
-    if ( (rc.stop == GNUNET_YES) ||
+    if ( (GNUNET_YES == rc.stop) ||
         (GNUNET_OK !=
          write_message 
(GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY,
                         "..", 3)) )
@@ -421,7 +427,7 @@
 #endif
 
   /* parse command line */
-  if ( (argc != 3) && (argc != 2) )
+  if ( (3 != argc) && (2 != argc) )
   {
     FPRINTF (stderr, 
             "%s",
@@ -430,7 +436,7 @@
   }
   filename_expanded = argv[1];
   ex = argv[2];
-  if ( (ex == NULL) ||
+  if ( (NULL == ex) ||
        (0 != strcmp (ex, "-")) )
   {
     plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
@@ -451,14 +457,17 @@
   if (GNUNET_OK !=
       write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, 
NULL, 0))
     return 3;  
-  if (GNUNET_OK !=
-      extract_files (root))
+  if (NULL != root)
   {
-    (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 
0);
+    if (GNUNET_OK !=
+       extract_files (root))
+    {
+      (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 
0);
+      free_tree (root);
+      return 4;
+    }
     free_tree (root);
-    return 4;
   }
-  free_tree (root);
   /* enable "clean" shutdown by telling parent that we are done */
   (void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, NULL, 
0);
   if (NULL != plugins)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]