-do not try to desearialize search directories
authorChristian Grothoff <christian@grothoff.org>
Sat, 18 Feb 2012 21:37:48 +0000 (21:37 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 18 Feb 2012 21:37:48 +0000 (21:37 +0000)
src/fs/fs_api.c

index cae2c693dc9acf870066e45c4bdc4dd2b6b0fa6e..b930f35bdd4be431daa73a713191bf01a040248d 100644 (file)
@@ -2641,7 +2641,15 @@ deserialize_search_file (void *cls, const char *filename)
   char *emsg;
   struct GNUNET_BIO_ReadHandle *rh;
   struct GNUNET_FS_SearchContext *sc;
+  struct stat buf;
 
+  if (0 != STAT (filename, &buf))
+  {
+    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "stat", filename);
+    return GNUNET_OK;
+  }
+  if (S_ISDIR (buf.st_mode))
+    return GNUNET_OK; /* skip directories */
   ser = get_serialization_short_name (filename);
   rh = GNUNET_BIO_read_open (filename);
   if (rh == NULL)