gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5132 - GNUnet/src/applications/state


From: gnunet
Subject: [GNUnet-SVN] r5132 - GNUnet/src/applications/state
Date: Sun, 24 Jun 2007 01:48:53 -0600 (MDT)

Author: grothoff
Date: 2007-06-24 01:48:52 -0600 (Sun, 24 Jun 2007)
New Revision: 5132

Modified:
   GNUnet/src/applications/state/state.c
Log:
fixing warning reported in #1233

Modified: GNUnet/src/applications/state/state.c
===================================================================
--- GNUnet/src/applications/state/state.c       2007-06-24 07:41:44 UTC (rev 
5131)
+++ GNUnet/src/applications/state/state.c       2007-06-24 07:48:52 UTC (rev 
5132)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2002, 2003, 2004, 2006 Christian Grothoff (and other contributing 
authors)
+     (C) 2002, 2003, 2004, 2006, 2007 Christian Grothoff (and other 
contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -72,28 +72,20 @@
           "%s/%s",
           dbh,
           name);
-  if (OK != disk_file_size(ectx,
-                          fil,
-                          &fsize,
-                          YES)) {
+  if ( (OK != disk_file_test(ectx,
+                            fil)) ||
+       (OK != disk_file_size(ectx,
+                            fil,
+                            &fsize,
+                            YES)) ||
+       (fsize == 0) ||
+       (-1 == (fd = disk_file_open(ectx,
+                                  fil,
+                                  O_RDONLY,
+                                  S_IRUSR) )) ) {
     FREE(fil);
     return -1;
   }
-  fd = disk_file_open(ectx,
-                     fil,
-                     O_RDONLY,
-                     S_IRUSR);
-  if (fd == -1) {
-    FREE(fil);
-    return -1;
-  }
-  if (fsize == 0) { /* also invalid! */
-    disk_file_close(ectx,
-                   fil,
-                   fd);
-    FREE(fil);
-    return -1;
-  }
   *result = MALLOC_LARGE(fsize);
   size = READ(fd,
              *result,





reply via email to

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