gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2490 - GNUnet/src/applications/fs/tools


From: grothoff
Subject: [GNUnet-SVN] r2490 - GNUnet/src/applications/fs/tools
Date: Sat, 11 Mar 2006 20:55:15 -0800 (PST)

Author: grothoff
Date: 2006-03-11 20:55:14 -0800 (Sat, 11 Mar 2006)
New Revision: 2490

Modified:
   GNUnet/src/applications/fs/tools/gnunet-directory.c
Log:
fix

Modified: GNUnet/src/applications/fs/tools/gnunet-directory.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-directory.c 2006-03-12 04:45:21 UTC 
(rev 2489)
+++ GNUnet/src/applications/fs/tools/gnunet-directory.c 2006-03-12 04:55:14 UTC 
(rev 2490)
@@ -88,19 +88,29 @@
   fd = fileopen(name,
                O_RDONLY);
 #endif
-  data = MMAP(NULL,
-             len,
-             PROT_READ,
-             MAP_SHARED,
-             fd,
-             0);
-  ret = ECRS_listDirectory(data,
-                          len,
-                          &md,
-                          &printNode,
-                          NULL);
-  MUNMAP(data, len);
-  closefile(fd);
+  if (fd == -1) {
+    LOG_FILE_STRERROR(LOG_ERROR, "open", name);
+    ret = -1;
+  } else {
+    data = MMAP(NULL,
+               len,
+               PROT_READ,
+               MAP_SHARED,
+               fd,
+               0);
+    if (data == MAP_FAILED) {
+      LOG_FILE_STRERROR(LOG_ERROR, "mmap", name);
+      ret = -1;
+    } else {
+      ret = ECRS_listDirectory(data,
+                              len,
+                              &md,
+                              &printNode,
+                              NULL);
+      MUNMAP(data, len);
+    }
+    closefile(fd);
+  }
   if (ret == -1)
     printf(_("File format error (not a GNUnet directory?)\n"));
   else





reply via email to

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