gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7647 - in GNUnet/src/util: disk os


From: gnunet
Subject: [GNUnet-SVN] r7647 - in GNUnet/src/util: disk os
Date: Sun, 31 Aug 2008 21:00:48 -0600 (MDT)

Author: grothoff
Date: 2008-08-31 21:00:46 -0600 (Sun, 31 Aug 2008)
New Revision: 7647

Modified:
   GNUnet/src/util/disk/storage.c
   GNUnet/src/util/os/check.conf
Log:
fix

Modified: GNUnet/src/util/disk/storage.c
===================================================================
--- GNUnet/src/util/disk/storage.c      2008-08-31 20:48:02 UTC (rev 7646)
+++ GNUnet/src/util/disk/storage.c      2008-09-01 03:00:46 UTC (rev 7647)
@@ -73,7 +73,7 @@
 } GetFileSizeData;
 
 static int
-getSizeRec (const char *filename, const char *dirname, void *ptr)
+getSizeRec (void * ptr, const char * fn)
 {
   GetFileSizeData *gfsd = ptr;
 #ifdef HAVE_STAT64
@@ -81,39 +81,13 @@
 #else
   struct stat buf;
 #endif
-  char *fn;
 
-  GNUNET_GE_ASSERT (gfsd->ectx, filename != NULL);
-  if ((dirname != NULL) && (strlen (dirname) > 0))
-    {
-      fn = GNUNET_malloc (strlen (filename) + strlen (dirname) + 3);
-      if (strlen (dirname) > 0)
-        {
-          strcpy (fn, dirname);
-          if (dirname[strlen (dirname) - 1] != DIR_SEPARATOR)
-            strcat (fn, DIR_SEPARATOR_STR);     /* add tailing / if needed */
-        }
-      /* Windows paths don't start with / */
-#ifndef MINGW
-      else
-        strcpy (fn, DIR_SEPARATOR_STR);
-#endif
-      if (filename[0] == DIR_SEPARATOR)
-        /* if filename starts with a "/", don't copy it */
-        strcat (fn, &filename[1]);
-      else
-        strcat (fn, filename);
-    }
-  else
-    fn = GNUNET_strdup (filename);
-
 #ifdef HAVE_STAT64
   if (0 != STAT64 (fn, &buf))
     {
       GNUNET_GE_LOG_STRERROR_FILE (gfsd->ectx,
                                    GNUNET_GE_WARNING | GNUNET_GE_USER |
                                    GNUNET_GE_REQUEST, "stat64", fn);
-      GNUNET_free (fn);
       return GNUNET_SYSERR;
     }
 #else
@@ -122,7 +96,6 @@
       GNUNET_GE_LOG_STRERROR_FILE (gfsd->ectx,
                                    GNUNET_GE_WARNING | GNUNET_GE_USER |
                                    GNUNET_GE_REQUEST, "stat", fn);
-      GNUNET_free (fn);
       return GNUNET_SYSERR;
     }
 #endif
@@ -134,12 +107,8 @@
     {
       if (GNUNET_SYSERR ==
           GNUNET_disk_directory_scan (gfsd->ectx, fn, &getSizeRec, gfsd))
-        {
-          GNUNET_free (fn);
-          return GNUNET_SYSERR;
-        }
+       return GNUNET_SYSERR;        
     }
-  GNUNET_free (fn);
   return GNUNET_OK;
 }
 
@@ -161,7 +130,7 @@
   gfsd.ectx = ectx;
   gfsd.total = 0;
   gfsd.include_sym_links = includeSymLinks;
-  ret = getSizeRec (filename, "", &gfsd);
+  ret = getSizeRec (&gfsd, filename);
   *size = gfsd.total;
   return ret;
 }
@@ -591,7 +560,7 @@
                          dname,
                          (strcmp(dname, DIR_SEPARATOR_STR) == 0) ? "" : 
DIR_SEPARATOR_STR,
                          finfo->d_name);
-          if (GNUNET_OK != callback (name, data))
+          if (GNUNET_OK != callback (data, name))
             {
               closedir (dinfo);
              GNUNET_free(name);

Modified: GNUnet/src/util/os/check.conf
===================================================================
--- GNUnet/src/util/os/check.conf       2008-08-31 20:48:02 UTC (rev 7646)
+++ GNUnet/src/util/os/check.conf       2008-09-01 03:00:46 UTC (rev 7647)
@@ -7,7 +7,7 @@
 [GNUNETD]
 GNUNETD_HOME     = /tmp/gnunet-util-os-test 
 HELLOEXPIRES     = 60
-LOGLEVEL        = ERROR 
+LOGLEVEL        = DEBUG
 LOGFILE         = $GNUNETD_HOME/log
 KEEPLOG         = 0
 PIDFILE         = $GNUNETD_HOME/gnunetd.pid





reply via email to

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