[PATCH] Portability patches

Ralph Böhme rb at sernet.de
Thu Oct 9 10:28:05 MDT 2014


Hi all,

attached please find two simple fixes for non-portable code that
exploded on my FreeBSD 10 testbox (the non-portable code, not the
fixes ;)

Cheerio!
-slow

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
-------------- next part --------------
>From 2cc93bbeacf2a1b868cbd2e3b18345a819176693 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 9 Oct 2014 14:34:02 +0200
Subject: [PATCH 1/2] lib/texpect: portability fix, include signal.h

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 lib/texpect/texpect.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
index c1a6a99..ac88979 100644
--- a/lib/texpect/texpect.c
+++ b/lib/texpect/texpect.c
@@ -62,6 +62,7 @@
 #include <popt.h>
 #include <errno.h>
 #include <err.h>
+#include <signal.h>
 
 struct command {
 	enum { CMD_EXPECT = 0, CMD_SEND, CMD_PASSWORD } type;
-- 
2.1.0


>From 5d111bb4a6e47c3785c5599cf2d33f0ca19cde36 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 9 Oct 2014 16:41:10 +0200
Subject: [PATCH 2/2] ncacn_http: fix GNUism

%a format conversion is a GNU extension, use the more portable %m.
It's at least in SUSv4, supported by glibc since 2.7 and FreeBSD 10.

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source4/lib/http/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source4/lib/http/http.c b/source4/lib/http/http.c
index 314ceed..c3bd728 100644
--- a/source4/lib/http/http.c
+++ b/source4/lib/http/http.c
@@ -112,7 +112,7 @@ static enum http_read_status http_parse_headers(struct http_read_response_state
 		return HTTP_ALL_DATA_READ;
 	}
 
-	n = sscanf(line, "%a[^:]: %a[^\r\n]\r\n", &key, &value);
+	n = sscanf(line, "%m[^:]: %m[^\r\n]\r\n", &key, &value);
 	if (n != 2) {
 		DEBUG(0, ("%s: Error parsing header '%s'\n", __func__, line));
 		status = HTTP_DATA_CORRUPTED;
@@ -158,7 +158,7 @@ static bool http_parse_response_line(struct http_read_response_state *state)
 		return false;
 	}
 
-	n = sscanf(line, "%a[^/]/%c.%c %d %a[^\r\n]\r\n",
+	n = sscanf(line, "%m[^/]/%c.%c %d %m[^\r\n]\r\n",
 		   &protocol, &major, &minor, &code, &msg);
 
 	DEBUG(11, ("%s: Header parsed(%i): protocol->%s, major->%c, minor->%c, "
-- 
2.1.0



More information about the samba-technical mailing list