[Commits] [SCM] claws branch, master, updated. 3.17.2-14-g191e8af

ticho at claws-mail.org ticho at claws-mail.org
Tue Dec 18 12:35:44 CET 2018


The branch, master has been updated
       via  191e8af118e60489af033890f9dfeedfdd14fb6c (commit)
      from  64f270d96795523d3e3b8d17164d4ba89648a1de (commit)

Summary of changes:
 src/common/utils.c |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 191e8af118e60489af033890f9dfeedfdd14fb6c
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Mon Dec 17 22:22:01 2018 +0100

    Allow empty output parameters in get_serverportfp_from_filename()

diff --git a/src/common/utils.c b/src/common/utils.c
index 2e646ba..a815c48 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -4652,17 +4652,27 @@ gboolean get_serverportfp_from_filename(const gchar *str, gchar **server, gchar
 		return FALSE;
 	}
 
-	*server = g_strndup(str, dotport_pos - str);
+	if (server != NULL)
+		*server = g_strndup(str, dotport_pos - str);
 	if (dotfp_pos) {
-		*port = g_strndup(dotport_pos + 1, dotfp_pos - dotport_pos - 1);
-		*fp = g_strndup(dotfp_pos + 1, dotcert_pos - dotfp_pos - 1);
+		if (port != NULL)
+			*port = g_strndup(dotport_pos + 1, dotfp_pos - dotport_pos - 1);
+		if (fp != NULL)
+			*fp = g_strndup(dotfp_pos + 1, dotcert_pos - dotfp_pos - 1);
 	} else {
-		*port = g_strndup(dotport_pos + 1, dotcert_pos - dotport_pos - 1);
-		*fp = NULL;
+		if (port != NULL)
+			*port = g_strndup(dotport_pos + 1, dotcert_pos - dotport_pos - 1);
+		if (fp != NULL)
+			*fp = NULL;
 	}
 
-	debug_print("filename='%s' => server='%s' port='%s' fp='%s'\n", str, *server, *port, *fp);
-	if (!*server || !*port)
+	debug_print("filename='%s' => server='%s' port='%s' fp='%s'\n",
+			str,
+			(server ? *server : "(n/a)"),
+			(port ? *port : "(n/a)"),
+			(fp ? *fp : "(n/a)"));
+
+	if (!(server && *server) || !(port && *port))
 		return FALSE;
 	else
 		return TRUE;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list