keyingmaterialexporter.c: include strings.h
PATCH 1/1 keyingmaterialexporter.c: include strings.h
strcasecmp() was initially declared in string.h and subsequently moved to strings.h. For historical reasons it still exists in string.h, but would require _DEFAULT_SOURCE to be defined.
Due to the above, just include strings.h as currently dictated by the manpage.
Fixes the following warning:
keying-material-exporter-demo/keyingmaterialexporter.c:155:14: warning: implicit declaration of function strncasecmp’; did you mean ‘strncmp’? [-Wimplicit-function-declaration]
155 | if (!strncasecmp(objbuf, "CN", 2))
| ^~~~~~~~~~~
| strncmp--- .../keying-material-exporter-demo/keyingmaterialexporter.c | 1 + 1 file changed, 1 insertion(+)
sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +1 -0
@@ -29,6 +29,7 @@#include <stdio.h> #include <string.h> +#include <strings.h> #include <stdlib.h> #include "openvpn-plugin.h"
Signature · 1 line
2.34.1
Hi,
Quoted 6 lines · Antonio Quartulli
strcasecmp()was initially declared instring.hand subsequently moved tostrings.h. For historical reasons it still exists instring.h, but would require_DEFAULT_SOURCEto be defined.Due to the above, just include
strings.has currently dictated by the manpage.
If we include strings.h, do we still need string.h then?
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Hi,
Quoted 11 lines · Gert Doering
Hi,
Quoted 6 lines · Antonio Quartulli
strcasecmp()was initially declared instring.hand subsequently moved tostrings.h. For historical reasons it still exists instring.h, but would require_DEFAULT_SOURCEto be defined.Due to the above, just include
strings.has currently dictated by the manpage.If we include
strings.h, do we still needstring.hthen?
Yes, because the file also uses strlen() and strncmp() (declared in string.h)
Regards,
Signature · 1 line
Antonio Quartulli
FreeBSD manpage confirms that <strings.h> should be used. Insanity, but well.
Your patch has been applied to the master and release/2.5 branch (bugfix, even if not very critical).
commit d93a2b6160759d42d3fbaecc7fc868a7120221ef (master) commit 2d31bf20dcffaab00a677bab06c8fe3816b6605b (release/2.5)
Author: Antonio Quartulli Date: Thu Feb 3 09:26:20 2022 +0100
keyingmaterialexporter.c: include strings.h
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg23702.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering