-fix misc issues
authorChristian Grothoff <christian@grothoff.org>
Wed, 6 Jul 2016 11:14:11 +0000 (11:14 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 6 Jul 2016 11:14:11 +0000 (11:14 +0000)
21 files changed:
src/arm/arm_api.c
src/ats-tests/ats-testing-log.c
src/ats-tests/gnunet-solver-eval.c
src/exit/gnunet-daemon-exit.c
src/gns/gnunet-gns-proxy.c
src/gns/gnunet-service-gns_interceptor.c
src/gns/gnunet-service-gns_resolver.c
src/gnsrecord/gnsrecord_misc.c
src/include/gnunet_pq_lib.h
src/namestore/plugin_namestore_sqlite.c
src/namestore/test_namestore_api_zone_iteration_stop.c
src/nse/perf_kdf.c
src/peerinfo/gnunet-service-peerinfo.c
src/pq/pq.c
src/regex/gnunet-regex-profiler.c
src/regex/regex_internal.c
src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
src/util/bandwidth.c
src/util/disk.c
src/util/network.c
src/util/test_server.c

index ed36c61cd5932d17fbe9c8c86aab48685d1aa8cc..19b192378e8a6bd289236e2825c5dc777c95d068 100644 (file)
@@ -322,7 +322,7 @@ check_arm_list_result (void *cls,
 {
   const char *pos = (const char *) &lres[1];
   uint16_t rcount = ntohs (lres->count);
-  uint16_t msize = ntohs (lres->arm_msg.header.size);
+  uint16_t msize = ntohs (lres->arm_msg.header.size) - sizeof (*lres);
   uint16_t size_check;
 
   size_check = 0;
@@ -355,7 +355,7 @@ handle_arm_list_result (void *cls,
   uint16_t rcount = ntohs (lres->count);
   const char *list[rcount];
   const char *pos = (const char *) &lres[1];
-  uint16_t msize = ntohs (lres->arm_msg.header.size);
+  uint16_t msize = ntohs (lres->arm_msg.header.size) - sizeof (*lres);
   struct GNUNET_ARM_Operation *op;
   uint16_t size_check;
   uint64_t id;
index 2442a8249ad5ca59e491d5d2c6d3342603940a75..61aca6b18d338de5875b910c2b4d6891b7e9dd7d 100644 (file)
@@ -686,7 +686,7 @@ GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l)
        }
        else
        {
-         mlt->total_throughput_send = 0;
+         mlt->total_throughput_recv = 0;
          //mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */
        }
      }
index 0d2460b7fc903bdec47cea63dfcd43e0704cb8f9..0e49a3a323976b6b76b9795bcccf13754fda69ad 100644 (file)
@@ -65,6 +65,7 @@ create_experiment ()
   return e;
 }
 
+
 static void
 free_experiment (struct Experiment *e)
 {
@@ -92,9 +93,11 @@ free_experiment (struct Experiment *e)
   GNUNET_free (e);
 }
 
+
 static int
-load_episode (struct Experiment *e, struct Episode *cur,
-    struct GNUNET_CONFIGURATION_Handle *cfg)
+load_episode (struct Experiment *e,
+              struct Episode *cur,
+              struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct GNUNET_ATS_TEST_Operation *o;
   char *sec_name;
@@ -186,8 +189,12 @@ load_episode (struct Experiment *e, struct Episode *cur,
     }
     if (o->dest_id > (e->num_slaves - 1))
     {
-      fprintf (stderr, "Invalid destination %llu in operation %u `%s' in episode %u\n",
-          o->dest_id, op_counter, op, cur->id);
+      fprintf (stderr,
+               "Invalid destination %llu in operation %u `%s' in episode %u\n",
+               o->dest_id,
+               op_counter,
+               op,
+               cur->id);
       GNUNET_free (op);
       GNUNET_free (op_name);
       GNUNET_free (sec_name);
@@ -197,9 +204,13 @@ load_episode (struct Experiment *e, struct Episode *cur,
     GNUNET_free (op_name);
 
     GNUNET_asprintf(&op_name, "op-%u-type", op_counter);
-    if ( (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_string(cfg,
-            sec_name, op_name, &type)) &&
-        ((STOP_SEND != o->type) || (STOP_PREFERENCE != o->type)))
+    if ( (GNUNET_SYSERR !=
+          GNUNET_CONFIGURATION_get_value_string(cfg,
+                                                sec_name,
+                                                op_name,
+                                                &type)) &&
+         (STOP_SEND != o->type) &&
+         (STOP_PREFERENCE != o->type) )
     {
       /* Load arguments for set_rate, start_send, set_preference */
       if (0 == strcmp (type, "constant"))
@@ -249,8 +260,11 @@ load_episode (struct Experiment *e, struct Episode *cur,
 
       /* Get max rate */
       GNUNET_asprintf(&op_name, "op-%u-max-rate", op_counter);
-      if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-          sec_name, op_name, &o->max_rate))
+      if (GNUNET_SYSERR ==
+          GNUNET_CONFIGURATION_get_value_number (cfg,
+                                                 sec_name,
+                                                 op_name,
+                                                 &o->max_rate))
       {
         if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
             (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) ||
index 854d12006c0bb765840d77a1be4b7d3a16aabd9a..7c67313e69da58030e666d0f06e98d5c8f225dec 100644 (file)
@@ -3671,13 +3671,17 @@ run (void *cls,
 
   if (GNUNET_YES == ipv6_enabled)
   {
+    ipv6addr = NULL;
     if ( (GNUNET_SYSERR ==
-         GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "IPV6ADDR",
+         GNUNET_CONFIGURATION_get_value_string (cfg,
+                                                 "exit",
+                                                 "IPV6ADDR",
                                                 &ipv6addr) ||
          (1 != inet_pton (AF_INET6, ipv6addr, &exit_ipv6addr))) )
     {
       GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "EXIT", "IPV6ADDR");
       GNUNET_SCHEDULER_shutdown ();
+      GNUNET_free_non_null (ipv6addr);
       return;
     }
     exit_argv[3] = ipv6addr;
@@ -3710,6 +3714,7 @@ run (void *cls,
   }
   if (GNUNET_YES == ipv4_enabled)
   {
+    ipv4addr = NULL;
     if ( (GNUNET_SYSERR ==
          GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "IPV4ADDR",
                                                 &ipv4addr) ||
@@ -3717,6 +3722,7 @@ run (void *cls,
       {
        GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "EXIT", "IPV4ADDR");
        GNUNET_SCHEDULER_shutdown ();
+        GNUNET_free_non_null (ipv4addr);
        return;
       }
     exit_argv[5] = ipv4addr;
index 7ab8843bba2a756e07758bc94fd51e8f42bc149b..83935ff76b8507d56d98fdfe93cca0addf6ada78 100644 (file)
@@ -409,7 +409,7 @@ enum SocksPhase
   SOCKS5_SOCKET_WITH_MHD,
 
   /**
-   * We've finished receiving upload data from MHD.
+   * We've started receiving upload data from MHD.
    */
   SOCKS5_SOCKET_UPLOAD_STARTED,
 
@@ -1230,7 +1230,7 @@ curl_upload_cb (void *buf, size_t size, size_t nmemb, void *cls)
                "Completed CURL UPLOAD\n");
     return 0; /* upload finished, can now download */
   }
-  if ( (SOCKS5_SOCKET_UPLOAD_STARTED != s5r->state) ||
+  if ( (SOCKS5_SOCKET_UPLOAD_STARTED != s5r->state) &&
        (SOCKS5_SOCKET_UPLOAD_DONE != s5r->state) )
   {
     GNUNET_break (0);
index 4d57230a156a52f08a3981c3041b2c46d390548d..7a3cfc0ddfe5a1e1966c6e7b7e9002873ba2b727 100644 (file)
@@ -261,6 +261,8 @@ reply_to_dns (void *cls, uint32_t rd_count,
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                  _("Error converting GNS response to DNS response!\n"));
+      if (GNUNET_NO == ret)
+        GNUNET_free (buf);
     }
     else
     {
index 2dec9a2af339a669f10f860000c002b514ed0e63..ce6428a44c1ac0ad356f791016e33497690136b3 100644 (file)
@@ -1323,6 +1323,7 @@ handle_gns2dns_result (void *cls,
   /* expand authority chain */
   ac = GNUNET_new (struct AuthorityChain);
   ac->rh = rh;
+  GNUNET_assert (strlen (rh->g2dc->ns) <= GNUNET_DNSPARSER_MAX_NAME_LENGTH);
   strcpy (ac->authority_info.dns_authority.name,
           rh->g2dc->ns);
   memcpy (&ac->authority_info.dns_authority.dns_ip,
index 27d1e7b2140184e97c647c1c2b1f91fd1151f7b5..4c3bf6fa8f89a3ad02390073e70e686b469f6ab6 100644 (file)
@@ -185,7 +185,7 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count,
       /* We have a shadow record */
       if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
       {
-        rt_shadow.rel_value_us = rd[2].expiration_time;
+        rt_shadow.rel_value_us = rd[c2].expiration_time;
         at_shadow = GNUNET_TIME_relative_to_absolute (rt_shadow);
       }
       else
index 4e4139b431de402451dfc0fc016b063439b55da9..33a3e54254cfe2fa47995b5e3c76992b9e7262dd 100644 (file)
@@ -442,15 +442,12 @@ GNUNET_PQ_exec_prepared (PGconn *db_conn,
 
 /**
  * Extract results from a query result according to the given specification.
- * If colums are NULL, the destination is not modified, and #GNUNET_NO
- * is returned.
  *
  * @param result result to process
  * @param[in,out] rs result specification to extract for
  * @param row row from the result to extract
  * @return
  *   #GNUNET_YES if all results could be extracted
- *   #GNUNET_NO if at least one result was NULL
  *   #GNUNET_SYSERR if a result was invalid (non-existing field)
  */
 int
index d6a2a28624ffde122acdd39f75aa7f409ec0a946..3710a4820e65d8ed252e3ab3d15dad73efbc2f06 100644 (file)
@@ -315,7 +315,7 @@ database_shutdown (struct Plugin *plugin)
     sqlite3_finalize (plugin->iterate_all_zones);
   if (NULL != plugin->zone_to_name)
     sqlite3_finalize (plugin->zone_to_name);
-  if (NULL != plugin->zone_to_name)
+  if (NULL != plugin->lookup_label)
     sqlite3_finalize (plugin->lookup_label);
   result = sqlite3_close (plugin->dbh);
   if (result == SQLITE_BUSY)
index 52645b5eb992c49ed3d1edc63da9f78888919caf..36f527da0024b400293bb96a297776a979e624cb 100644 (file)
@@ -365,27 +365,26 @@ empty_zone_proc (void *cls,
   char *hostkey_file;
 
   GNUNET_assert (nsh == cls);
-       if (NULL != zone)
-       {
-         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                       _("Expected empty zone but received zone private key\n"));
+  if (NULL != zone)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                _("Expected empty zone but received zone private key\n"));
     GNUNET_break (0);
     if (endbadly_task != NULL)
-       GNUNET_SCHEDULER_cancel (endbadly_task);
+      GNUNET_SCHEDULER_cancel (endbadly_task);
     endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
     return;
-       }
-       if ((NULL != label) || (NULL != rd) || (0 != rd))
-       {
-         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                       _("Expected no zone content but received data\n"));
+  }
+  if ((NULL != label) || (NULL != rd) || (0 != rd_count))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                _("Expected no zone content but received data\n"));
     GNUNET_break (0);
     if (endbadly_task != NULL)
-       GNUNET_SCHEDULER_cancel (endbadly_task);
+      GNUNET_SCHEDULER_cancel (endbadly_task);
     endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
     return;
-       }
-
+  }
 
   zi = NULL;
   GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
index b62b5eba6af5d6e0c2621d4fb7214e568da8af6d..4981eae5df6e79d385306997fc05790edb46e7de 100644 (file)
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
           GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start),
                                                  GNUNET_YES));
   GAUGER ("NSE", "Proof-of-work hashing",
-          1024 / (1 +
+          1024LL / (1LL +
                  GNUNET_TIME_absolute_get_duration
                  (start).rel_value_us / 1000LL), "hashes/ms");
   return 0;
index 66082e8f783a1565382a0150466926baaea0aa47..8be6cf5abff0a82464b5c7cca61d4f769b0087aa 100644 (file)
@@ -338,12 +338,12 @@ read_host_file (const char *fn,
                 struct ReadHostFileContext *r)
 {
   char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN;
-  unsigned int size_total;
+  ssize_t size_total;
   struct GNUNET_TIME_Absolute now;
   unsigned int left;
   const struct GNUNET_HELLO_Message *hello;
   struct GNUNET_HELLO_Message *hello_clean;
-  unsigned read_pos;
+  size_t read_pos;
   int size_hello;
 
   r->friend_only_hello = NULL;
@@ -1005,6 +1005,7 @@ discard_hosts_helper (void *cls,
        GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
                                  GNUNET_ERROR_TYPE_BULK,
                                   "unlink", fn);
+      GNUNET_free (writebuffer);
       return GNUNET_OK;
     }
     new_hello = GNUNET_HELLO_iterate_addresses (hello,
@@ -1028,11 +1029,13 @@ discard_hosts_helper (void *cls,
 
   if (0 < write_pos)
   {
-      GNUNET_DISK_fn_write (fn, writebuffer,write_pos,
-                            GNUNET_DISK_PERM_USER_READ |
-                            GNUNET_DISK_PERM_USER_WRITE |
-                            GNUNET_DISK_PERM_GROUP_READ |
-                            GNUNET_DISK_PERM_OTHER_READ);
+    GNUNET_DISK_fn_write (fn,
+                          writebuffer,
+                          write_pos,
+                          GNUNET_DISK_PERM_USER_READ |
+                          GNUNET_DISK_PERM_USER_WRITE |
+                          GNUNET_DISK_PERM_GROUP_READ |
+                          GNUNET_DISK_PERM_OTHER_READ);
   }
   else if (0 != UNLINK (fn))
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
index 43186c41e7142d8f4db60d6b14ac6a8c2816c181..46463a190500d8286867046bbc21e5bc58c7562f 100644 (file)
@@ -119,15 +119,13 @@ GNUNET_PQ_cleanup_result (struct GNUNET_PQ_ResultSpec *rs)
 
 /**
  * Extract results from a query result according to the given
- * specification.  If colums are NULL, the destination is not
- * modified, and #GNUNET_NO is returned.
+ * specification.
  *
  * @param result result to process
  * @param[in,out] rs result specification to extract for
  * @param row row from the result to extract
  * @return
  *   #GNUNET_YES if all results could be extracted
- *   #GNUNET_NO if at least one result was NULL
  *   #GNUNET_SYSERR if a result was invalid (non-existing field)
  */
 int
@@ -136,7 +134,6 @@ GNUNET_PQ_extract_result (PGresult *result,
                          int row)
 {
   unsigned int i;
-  int had_null = GNUNET_NO;
   int ret;
 
   for (i=0; NULL != rs[i].conv; i++)
@@ -150,7 +147,7 @@ GNUNET_PQ_extract_result (PGresult *result,
                      spec->fname,
                      &spec->dst_size,
                      spec->dst);
-    if (GNUNET_SYSERR == ret)
+    if (GNUNET_OK != ret)
     {
       GNUNET_PQ_cleanup_result (rs);
       return GNUNET_SYSERR;
@@ -158,8 +155,6 @@ GNUNET_PQ_extract_result (PGresult *result,
     if (NULL != spec->result_size)
       *spec->result_size = spec->dst_size;
   }
-  if (GNUNET_YES == had_null)
-    return GNUNET_NO;
   return GNUNET_OK;
 }
 
index 2114e2cb15eef7d0adf44fab66b63cb262297f08..c5ecf3b4d958af58303c3dc97523d9206892d7c1 100644 (file)
@@ -1231,41 +1231,55 @@ load_search_strings (const char *filename,
                 "Could not find search strings file %s\n", filename);
     return GNUNET_SYSERR;
   }
-  if (GNUNET_OK != GNUNET_DISK_file_size (filename, &filesize, GNUNET_YES, GNUNET_YES))
+  if (GNUNET_OK !=
+      GNUNET_DISK_file_size (filename,
+                             &filesize,
+                             GNUNET_YES,
+                             GNUNET_YES))
     filesize = 0;
   if (0 == filesize)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Search strings file %s is empty.\n", filename);
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Search strings file %s is empty.\n",
+                filename);
     return GNUNET_SYSERR;
   }
-  data = GNUNET_malloc (filesize);
-  if (filesize != GNUNET_DISK_fn_read (filename, data, filesize))
+  data = GNUNET_malloc (filesize + 1);
+  if (filesize != GNUNET_DISK_fn_read (filename,
+                                       data,
+                                       filesize))
   {
     GNUNET_free (data);
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not read search strings file %s.\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Could not read search strings file %s.\n",
          filename);
     return GNUNET_SYSERR;
   }
   buf = data;
   offset = 0;
   str_cnt = 0;
-  while (offset < (filesize - 1) && str_cnt < limit)
+  while ( (offset < (filesize - 1)) && (str_cnt < limit) )
   {
     offset++;
-    if (((data[offset] == '\n')) && (buf != &data[offset]))
+    if ( ((data[offset] == '\n')) &&
+         (buf != &data[offset]) )
     {
       data[offset] = '\0';
       str_cnt++;
       buf = &data[offset + 1];
     }
-    else if ((data[offset] == '\n') || (data[offset] == '\0'))
+    else if ( (data[offset] == '\n') ||
+              (data[offset] == '\0') )
       buf = &data[offset + 1];
   }
   *strings = GNUNET_malloc (sizeof (char *) * str_cnt);
   offset = 0;
   for (i = 0; i < str_cnt; i++)
   {
-    GNUNET_asprintf (&(*strings)[i], "%s%s", regex_prefix, &data[offset]);
+    GNUNET_asprintf (&(*strings)[i],
+                     "%s%s",
+                     regex_prefix,
+                     &data[offset]);
     offset += strlen (&data[offset]) + 1;
   }
   GNUNET_free (data);
index 616b7f141c69a13e6775a1488ba29bc6fb9d72ce..cb78545b9fd7296b18ee9ab0868bcdf9225c0211 100644 (file)
@@ -2037,9 +2037,9 @@ dfa_merge_nondistinguishable_states (struct REGEX_INTERNAL_Context *ctx,
              /* same edge, but targets definitively different, so we're different
                 as well */
              if (t1->to_state->marked > t2->to_state->marked)
-               idx1 = t1->to_state->marked * state_cnt + t2->to_state->marked;
+               idx1 = (unsigned long long) t1->to_state->marked * state_cnt + t2->to_state->marked;
              else
-               idx1 = t2->to_state->marked * state_cnt + t1->to_state->marked;
+               idx1 = (unsigned long long) t2->to_state->marked * state_cnt + t1->to_state->marked;
              if (0 != (table[idx1 / 32] & (1 << (idx1 % 32))))
              {
                table[idx / 32] |= (1 << (idx % 32));
@@ -2066,7 +2066,7 @@ dfa_merge_nondistinguishable_states (struct REGEX_INTERNAL_Context *ctx,
     for (s2 = a->states_head; NULL != s2 && s1 != s2; s2 = s2_next)
     {
       s2_next = s2->next;
-      idx = s1->marked * state_cnt + s2->marked;
+      idx = (unsigned long long) s1->marked * state_cnt + s2->marked;
       if (0 == (table[idx / 32] & (1 << (idx % 32))))
         automaton_merge_states (ctx, a, s1, s2);
     }
index 9d0bf57b13aa063ba3f9fb2b84415fa0c55548ef..a8dce9115f9349b9977f7001dfbb2ac0c8823445 100644 (file)
@@ -357,7 +357,7 @@ destroy_service_session (struct BobServiceSession *s)
     gcry_mpi_point_release (s->prod_g_i_b_i);
     s->prod_g_i_b_i = NULL;
   }
-  if (NULL != s->prod_g_i_b_i)
+  if (NULL != s->prod_h_i_b_i)
   {
     gcry_mpi_point_release (s->prod_h_i_b_i);
     s->prod_h_i_b_i = NULL;
index 364c469779e170d69ec64847c5cd455b9c3128a2..bc5c02d60650ad2977b5645d634a88a4f228c120 100644 (file)
@@ -177,7 +177,7 @@ update_excess (struct GNUNET_BANDWIDTH_Tracker *av)
        500000LL) / 1000000LL;
   current_consumption = av->consumption_since_last_update__ - delta_avail;
   /* negative current_consumption means that we have savings */
-  max_carry = av->available_bytes_per_s__ * av->max_carry_s__;
+  max_carry = (uint64_t) av->available_bytes_per_s__ * av->max_carry_s__;
   if (max_carry < GNUNET_SERVER_MAX_MESSAGE_SIZE)
     max_carry = GNUNET_SERVER_MAX_MESSAGE_SIZE;
   left_bytes = max_carry + current_consumption;
index 4624df7c1e0359191176d887fc1c667feaf0fab9..d9ebde84f3e15948a84fd135aee41a5a29d293ad 100644 (file)
@@ -527,14 +527,18 @@ char *
 GNUNET_DISK_mkdtemp (const char *t)
 {
   char *fn;
+  mode_t omask;
 
+  omask = umask (S_IWGRP | S_IWOTH | SIRGRP | S_IROTH);
   fn = mktemp_name (t);
   if (fn != mkdtemp (fn))
   {
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "mkstemp", fn);
+    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "mkdtemp", fn);
     GNUNET_free (fn);
+    umask (omask);
     return NULL;
   }
+  umask (omask);
   return fn;
 }
 
@@ -587,14 +591,18 @@ GNUNET_DISK_mktemp (const char *t)
 {
   int fd;
   char *fn;
+  mode_t omask;
 
+  omask = umask (S_IWGRP | S_IWOTH | SIRGRP | S_IROTH);
   fn = mktemp_name (t);
   if (-1 == (fd = mkstemp (fn)))
   {
     LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "mkstemp", fn);
     GNUNET_free (fn);
+    umask (omask);
     return NULL;
   }
+  umask (omask);
   if (0 != CLOSE (fd))
     LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "close", fn);
   return fn;
index e42dfc4dcf29c9c56827ee3f07e5064707843898..ba213b412ab5a0192f93c907fbba9fbbeba3c4bf 100644 (file)
@@ -166,6 +166,12 @@ GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
   int ret;
 
   s = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (-1 == s)
+  {
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                         "Failed to open AF_UNIX socket");
+    return;
+  }
   ret = connect (s,
                  (struct sockaddr *) un,
                  sizeof (struct sockaddr_un));
index f82ecb2b1ae481f323bdc18f33ebeff0eb493591..384a1cef07cd15711cc82c9637f0d902d1f15cdd 100644 (file)
@@ -239,7 +239,6 @@ task (void *cls)
     GNUNET_MQ_handler_end ()
   };
 
-
   sap[0] = (struct sockaddr *) &sa;
   slens[0] = sizeof (sa);
   sap[1] = NULL;