aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-04-11 11:37:46 +0200
committerChristian Grothoff <christian@grothoff.org>2017-04-11 11:37:46 +0200
commit51e9f26b1014d6f935cacad7da75d98234653482 (patch)
treeecbd7394cfd571c8041767287ea17e7cb862f1ca
parent2b3d804abaff87da0b07f8f6da115a05f6664ebe (diff)
downloadgnunet-51e9f26b1014d6f935cacad7da75d98234653482.tar.gz
gnunet-51e9f26b1014d6f935cacad7da75d98234653482.zip
fix #4985
-rw-r--r--src/cadet/cadet_api.c16
-rw-r--r--src/conversation/gnunet-service-conversation.c8
-rw-r--r--src/include/gnunet_cadet_service.h2
-rw-r--r--src/include/gnunet_disk_lib.h3
-rw-r--r--src/util/strings.c1
5 files changed, 22 insertions, 8 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index decf473a9..3fdeffe13 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -1583,7 +1583,7 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
1583 * @param window_changes Function called when the transmit window size changes. 1583 * @param window_changes Function called when the transmit window size changes.
1584 * @param disconnects Function called when a channel is disconnected. 1584 * @param disconnects Function called when a channel is disconnected.
1585 * @param handlers Callbacks for messages we care about, NULL-terminated. 1585 * @param handlers Callbacks for messages we care about, NULL-terminated.
1586 * @return Port handle. 1586 * @return Port handle, NULL if port is in use
1587 */ 1587 */
1588struct GNUNET_CADET_Port * 1588struct GNUNET_CADET_Port *
1589GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, 1589GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h,
@@ -1604,17 +1604,21 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h,
1604 p = GNUNET_new (struct GNUNET_CADET_Port); 1604 p = GNUNET_new (struct GNUNET_CADET_Port);
1605 p->cadet = h; 1605 p->cadet = h;
1606 p->id = *port; 1606 p->id = *port;
1607 if (GNUNET_OK !=
1608 GNUNET_CONTAINER_multihashmap_put (h->ports,
1609 &p->id,
1610 p,
1611 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
1612 {
1613 GNUNET_free (p);
1614 return NULL;
1615 }
1607 p->connects = connects; 1616 p->connects = connects;
1608 p->cls = connects_cls; 1617 p->cls = connects_cls;
1609 p->window_changes = window_changes; 1618 p->window_changes = window_changes;
1610 p->disconnects = disconnects; 1619 p->disconnects = disconnects;
1611 p->handlers = GNUNET_MQ_copy_handlers (handlers); 1620 p->handlers = GNUNET_MQ_copy_handlers (handlers);
1612 1621
1613 GNUNET_assert (GNUNET_OK ==
1614 GNUNET_CONTAINER_multihashmap_put (h->ports,
1615 &p->id,
1616 p,
1617 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
1618 1622
1619 env = GNUNET_MQ_msg (msg, 1623 env = GNUNET_MQ_msg (msg,
1620 GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN); 1624 GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN);
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 5f43bfe80..7d319e51e 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -1270,6 +1270,14 @@ handle_client_register_message (void *cls,
1270 NULL, 1270 NULL,
1271 &inbound_end, 1271 &inbound_end,
1272 cadet_handlers); 1272 cadet_handlers);
1273 if (NULL == line->port)
1274 {
1275 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1276 _("Could not open line, port %s already in use!\n"),
1277 GNUNET_h2s (&msg->line_port));
1278 GNUNET_SERVICE_client_drop (line->client);
1279 return;
1280 }
1273 GNUNET_SERVICE_client_continue (line->client); 1281 GNUNET_SERVICE_client_continue (line->client);
1274} 1282}
1275 1283
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index f76f17a51..e2edbcc2c 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -221,7 +221,7 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle);
221 * Can be NULL. 221 * Can be NULL.
222 * @param disconnects Function called when a channel is disconnected. 222 * @param disconnects Function called when a channel is disconnected.
223 * @param handlers Callbacks for messages we care about, NULL-terminated. 223 * @param handlers Callbacks for messages we care about, NULL-terminated.
224 * @return Port handle. 224 * @return Port handle, NULL if port is in use
225 */ 225 */
226struct GNUNET_CADET_Port * 226struct GNUNET_CADET_Port *
227GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, 227GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h,
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index 02c4b3674..be2885460 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -331,7 +331,8 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, off_t offset,
331 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 331 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
332 */ 332 */
333int 333int
334GNUNET_DISK_file_size (const char *filename, uint64_t *size, 334GNUNET_DISK_file_size (const char *filename,
335 uint64_t *size,
335 int include_symbolic_links, 336 int include_symbolic_links,
336 int single_file_mode); 337 int single_file_mode);
337 338
diff --git a/src/util/strings.c b/src/util/strings.c
index d3268f4d9..f554a9e83 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -818,6 +818,7 @@ GNUNET_STRINGS_get_short_name (const char *filename)
818{ 818{
819 const char *short_fn = filename; 819 const char *short_fn = filename;
820 const char *ss; 820 const char *ss;
821
821 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR)) 822 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR))
822 && (ss[1] != '\0')) 823 && (ss[1] != '\0'))
823 short_fn = 1 + ss; 824 short_fn = 1 + ss;