gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r252 - in GNUnet/src/applications: fs fs/module sqstore_mys


From: grothoff
Subject: [GNUnet-SVN] r252 - in GNUnet/src/applications: fs fs/module sqstore_mysql
Date: Sat, 12 Feb 2005 21:06:31 -0800 (PST)

Author: grothoff
Date: 2005-02-12 21:06:30 -0800 (Sat, 12 Feb 2005)
New Revision: 252

Modified:
   GNUnet/src/applications/fs/ecrs_core.c
   GNUnet/src/applications/fs/module/ondemand.c
   GNUnet/src/applications/sqstore_mysql/mysql.c
   GNUnet/src/applications/sqstore_mysql/mysqltest.c
Log:
more bugfixes

Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c      2005-02-13 04:53:33 UTC (rev 
251)
+++ GNUnet/src/applications/fs/ecrs_core.c      2005-02-13 05:06:30 UTC (rev 
252)
@@ -59,22 +59,23 @@
            &skey,
            &iv[0]);
   val = MALLOC(sizeof(Datastore_Value)
-              + len + sizeof(DBlock));
+              + len);
   val->size = htonl(sizeof(Datastore_Value) + 
-                   len + sizeof(DBlock));
+                   len);
   val->type = htonl(D_BLOCK);
   val->prio = htonl(0);
   val->anonymityLevel = htonl(0);
   val->expirationTime = htonl(0);
   db = (DBlock*) &val[1];
   db->type = htonl(D_BLOCK);
-  GNUNET_ASSERT(len == encryptBlock(&data[1],
-                                   len - sizeof(DBlock),
-                                   &skey,
-                                   iv,
-                                   &db[1]));
-  hash(val,
-       len,
+  GNUNET_ASSERT(len - sizeof(DBlock)
+               == encryptBlock(&data[1],
+                               len - sizeof(DBlock),
+                               &skey,
+                               iv,
+                               &db[1]));
+  hash(&db[1],
+       len - sizeof(DBlock),
        &hc);
   if (equalsHashCode160(query,
                        &hc)) {

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2005-02-13 04:53:33 UTC 
(rev 251)
+++ GNUnet/src/applications/fs/module/ondemand.c        2005-02-13 05:06:30 UTC 
(rev 252)
@@ -209,7 +209,7 @@
 
   if (ntohl(dbv->size) != sizeof(OnDemandBlock)) {
     BREAK();
-    goto FAILURE;
+    return SYSERR;
   }
   odb = (OnDemandBlock*) dbv;
   fn = getOnDemandFile(&odb->fileId);
@@ -218,7 +218,7 @@
   if (fileHandle == -1) {
     LOG_FILE_STRERROR(LOG_ERROR, "open", fn);
     FREE(fn);
-    goto FAILURE;
+    return SYSERR;
   }
 
 #if TRACK_INDEXED_FILES
@@ -254,7 +254,7 @@
     LOG_FILE_STRERROR(LOG_WARNING, "lseek", fn);
     FREE(fn);
     CLOSE(fileHandle);
-    goto FAILURE;
+    return SYSERR;
   }
   db = MALLOC(sizeof(DBlock) + ntohl(odb->blockSize));
   db->type = htonl(D_BLOCK);
@@ -267,24 +267,21 @@
     FREE(fn);
     FREE(db);
     CLOSE(fileHandle);
-    goto FAILURE;
+    return SYSERR;
   }
   ret = fileBlockEncode(db,
                        ntohl(odb->blockSize) + sizeof(DBlock),
                        query,
                        enc);
-  (*enc)->anonymityLevel = dbv->anonymityLevel;
-  (*enc)->expirationTime = dbv->expirationTime;
-  (*enc)->prio = dbv->prio;
   FREE(db);
   FREE(fn);
   if (ret == SYSERR)
-    goto FAILURE;
+    return SYSERR;
+  
+  (*enc)->anonymityLevel = dbv->anonymityLevel;
+  (*enc)->expirationTime = dbv->expirationTime;
+  (*enc)->prio = dbv->prio;
   return OK;   
- FAILURE:
-  datastore->del(query,
-                dbv);
-  return SYSERR;
 }
 
 /**

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2005-02-13 04:53:33 UTC 
(rev 251)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2005-02-13 05:06:30 UTC 
(rev 252)
@@ -245,6 +245,8 @@
  * @return OK on success
  */
 static int iopen(mysqlHandle * dbhI) {
+  char * dbname;
+
   if (dbhI->cnffile == NULL)
     return SYSERR;
   dbhI->dbf = mysql_init(NULL);
@@ -256,14 +258,19 @@
   mysql_options(dbhI->dbf, 
                MYSQL_READ_DEFAULT_GROUP, 
                "client");
+  dbname = getConfigurationString("MYSQL",
+                                 "DATABASE");
+  if (dbname == NULL)
+    dbname = STRDUP("gnunet");
   mysql_real_connect(dbhI->dbf,
                     NULL,
                     NULL,
                     NULL,
-                    "gnunet",
+                    dbname,
                     0,
                     NULL,
                     0);
+  FREE(dbname);
   if (mysql_error(dbhI->dbf)[0]) {
     LOG_MYSQL(LOG_ERROR, 
              "mysql_real_connect",

Modified: GNUnet/src/applications/sqstore_mysql/mysqltest.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest.c   2005-02-13 04:53:33 UTC 
(rev 251)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest.c   2005-02-13 05:06:30 UTC 
(rev 252)
@@ -164,11 +164,9 @@
   FREENONNULL(setConfigurationString("FILES",
                                     "gnunet.conf",
                                     "/tmp/gnunet_test/gnunet.conf"));
-  tmp = expandFileName("~/.my-debug.cnf");
   FREENONNULL(setConfigurationString("MYSQL",
-                                    "CONFIG",
-                                    tmp));
-  FREE(tmp);
+                                    "DATABASE",
+                                    "gnunetcheck"));
   return OK;
 }
 





reply via email to

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