| 1 |
From 3d3a936b696d73f24a7f1a99bf7aa26735ff2306 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Samuel Thibault <[email protected]> |
| 3 |
Date: Wed, 27 Aug 2025 16:20:02 +0200 |
| 4 |
Subject: [PATCH] Fix GNU/Hurd build (#1975) |
| 5 |
Origin: https://github.com/proftpd/proftpd/commit/3d3a936b696d73f24a7f1a99bf7aa26735ff2306 |
| 6 |
MIME-Version: 1.0 |
| 7 |
Content-Type: text/plain; charset=UTF-8 |
| 8 |
Content-Transfer-Encoding: 8bit |
| 9 |
|
| 10 |
GNU/Hurd uses the same glibc as Linux, and as such also follows posix by |
| 11 |
making the 2nd parameter of iconv() a char**. |
| 12 |
|
| 13 |
Otherwise, we get: |
| 14 |
``` |
| 15 |
encode.c: In function ‘str_convert’: |
| 16 |
encode.c:71:25: error: passing argument 2 of ‘iconv’ from incompatible pointer type [-Wincompatible-pointer-types] |
| 17 |
71 | nconv = iconv(conv, &inbuf, inbuflen, &outbuf, outbuflen); |
| 18 |
| ^~~~~~ |
| 19 |
| | |
| 20 |
| const char ** |
| 21 |
In file included from encode.c:32: |
| 22 |
/usr/include/iconv.h:49:54: note: expected ‘char ** restrict’ but argument is of type ‘const char **’ |
| 23 |
49 | extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, |
| 24 |
| ~~~~~~~~~~~~~~~~~~^~~~~~~ |
| 25 |
``` |
| 26 |
--- |
| 27 |
contrib/mod_sftp/utf8.c | 4 ++-- |
| 28 |
src/encode.c | 4 ++-- |
| 29 |
2 files changed, 4 insertions(+), 4 deletions(-) |
| 30 |
|
| 31 |
diff --git a/contrib/mod_sftp/utf8.c b/contrib/mod_sftp/utf8.c |
| 32 |
index d8078239b..021aa2739 100644 |
| 33 |
--- a/contrib/mod_sftp/utf8.c |
| 34 |
+++ b/contrib/mod_sftp/utf8.c |
| 35 |
@@ -52,11 +52,11 @@ static int utf8_convert(iconv_t conv, const char *inbuf, size_t *inbuflen, |
| 36 |
pr_signals_handle(); |
| 37 |
|
| 38 |
/* Solaris/FreeBSD's iconv(3) takes a const char ** for the input buffer, |
| 39 |
- * whereas Linux/Mac OSX iconv(3) use char ** for the input buffer. |
| 40 |
+ * whereas Linux/Mac OSX/GNU iconv(3) use char ** for the input buffer. |
| 41 |
*/ |
| 42 |
#if defined(LINUX) || defined(DARWIN6) || defined(DARWIN7) || \ |
| 43 |
defined(DARWIN8) || defined(DARWIN9) || defined(DARWIN10) || \ |
| 44 |
- defined(DARWIN11) || defined(DARWIN12) |
| 45 |
+ defined(DARWIN11) || defined(DARWIN12) || defined(GNU) |
| 46 |
|
| 47 |
nconv = iconv(conv, (char **) &inbuf, inbuflen, &outbuf, outbuflen); |
| 48 |
#else |
| 49 |
diff --git a/src/encode.c b/src/encode.c |
| 50 |
index 245b2d43a..3af7fad50 100644 |
| 51 |
--- a/src/encode.c |
| 52 |
+++ b/src/encode.c |
| 53 |
@@ -60,11 +60,11 @@ static int str_convert(iconv_t conv, const char *inbuf, size_t *inbuflen, |
| 54 |
pr_signals_handle(); |
| 55 |
|
| 56 |
/* Solaris/FreeBSD's iconv(3) takes a const char ** for the input buffer, |
| 57 |
- * whereas Linux/Mac OSX iconv(3) use char ** for the input buffer. |
| 58 |
+ * whereas Linux/Mac OSX/GNU iconv(3) use char ** for the input buffer. |
| 59 |
*/ |
| 60 |
#if defined(LINUX) || defined(DARWIN6) || defined(DARWIN7) || \ |
| 61 |
defined(DARWIN8) || defined(DARWIN9) || defined(DARWIN10) || \ |
| 62 |
- defined(DARWIN11) || defined(DARWIN12) |
| 63 |
+ defined(DARWIN11) || defined(DARWIN12) || defined(GNU) |
| 64 |
|
| 65 |
nconv = iconv(conv, (char **) &inbuf, inbuflen, &outbuf, outbuflen); |
| 66 |
#else |