code clean up
authorChristian Grothoff <christian@grothoff.org>
Fri, 18 Jun 2010 14:30:23 +0000 (14:30 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 18 Jun 2010 14:30:23 +0000 (14:30 +0000)
src/arm/gnunet-service-arm_interceptor.c
src/core/gnunet-service-core.c
src/fs/fs_uri.c
src/hostlist/hostlist-server.c
src/util/disk.c
src/util/os_installation.c
src/util/service.c

index afefe4e482e585273ca1f3f107e9cdaba1ad644c..9380a8debfe3d3c68c0c7611aa3147c0d5d6f053 100644 (file)
@@ -474,14 +474,14 @@ receiveFromService (void *cls,
                                BUFFER_SIZE);
   if (fc->service_to_client_bufferDataLength <= 0)
     {
+#if DEBUG_SERVICE_MANAGER
       if (fc->service_to_client_bufferDataLength == 0)
        {
-#if DEBUG_SERVICE_MANAGER
          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                      "Service `%s' stopped sending data.\n",
                      fc->listen_info->serviceName);
-#endif
        }
+#endif
       if (fc->first_write_done != GNUNET_YES)
        {
          fc->service_to_client_bufferDataLength = 0;
index 7a2111e0e0c17f8e3800631d8d1d7546eb944f3e..34b3511a8b745f6fdf93100335423b06c0b3f57a 100644 (file)
@@ -3205,7 +3205,9 @@ deliver_message (struct Neighbour *sender,
                  (unsigned int) type,
                  GNUNET_i2s (&sender->peer));
 #endif
-      /* FIXME: stats... */
+      GNUNET_STATISTICS_update (stats,
+                               gettext_noop ("# messages not delivered to any client"), 
+                               1, GNUNET_NO);
     }
 }
 
index 2e1ec92c84368fb284a73da8ab7a70d42525885e..f2c291784a5ce2c0f5c3e66e079783362e146c19 100644 (file)
@@ -1756,7 +1756,7 @@ bin2enc (const void *data, size_t size)
         }
     }
   if (hbits > 0)
-    ret[len++] = tbl[bits & 63];
+    ret[len] = tbl[bits & 63];
   return ret;
 }
 
index 8d4d38d0912b410b7f7d5fafd88b94ccda6c5865..5d8a07ef2cfe4a4e588cd836ddd13f697ba4ef82 100644 (file)
@@ -62,12 +62,12 @@ static struct GNUNET_STATISTICS_Handle *stats;
 /**
  * Handle to the core service (NULL until we've connected to it).
  */
-struct GNUNET_CORE_Handle *core;
+static struct GNUNET_CORE_Handle *core;
 
 /**
  * Handle to the peerinfo notify service (NULL until we've connected to it).
  */
-struct GNUNET_PEERINFO_NotifyContext *notify;
+static struct GNUNET_PEERINFO_NotifyContext *notify;
 
 /**
  * Our primary task for IPv4.
index bcede53e463a550eabc8632137036a36153ae162..94615f198565e86124d5eee67b385b8658108426 100644 (file)
@@ -704,6 +704,8 @@ GNUNET_DISK_directory_scan (const char *dirName,
 
   GNUNET_assert (dirName != NULL);
   dname = GNUNET_STRINGS_filename_expand (dirName);
+  if (dname == NULL)
+    return GNUNET_SYSERR;
   while ((strlen (dname) > 0) && (dname[strlen (dname) - 1] == DIR_SEPARATOR))
     dname[strlen (dname) - 1] = '\0';
   if (0 != STAT (dname, &istat))
index c610281878b560e1f074aee296096c5ba605e904..19469e81e38bd5d509528addd9b55904181946ae 100644 (file)
@@ -96,11 +96,12 @@ get_path_from_proc_exe ()
   GNUNET_snprintf (fn, 
                   sizeof(fn), "/proc/%u/exe", getpid ());
   size = readlink (fn, lnk, sizeof (lnk)-1);
-  if ((size == 0) || (size >= sizeof(lnk)-1))
+  if (size <= 0)
     {
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "readlink", fn);
       return NULL;
     }
+  GNUNET_assert (size < sizeof (lnk));
   lnk[size] = '\0';
   while ((lnk[size] != '/') && (size > 0))
     size--;
index a4316768d8858b767f1e5117658398780ad005c7..cd27380ee2d99f1f54c3f89a59f7c95ede402476 100644 (file)
@@ -732,10 +732,11 @@ add_unixpath (struct sockaddr **saddrs,
          unixpath,
          slen);
   un->sun_path[slen] = '\0';
-  slen += sizeof (sa_family_t);
 #if LINUX
   un->sun_path[0] = '\0';
   slen = sizeof (struct sockaddr_un);
+#else
+  slen += sizeof (sa_family_t);
 #endif
   *saddrs = (struct sockaddr*) un;
   *saddrlens = slen;