On 2012.05.07 12:32, Xiaofan Chen wrote:
There is one minor warning under OpenBSD (5.1 Current).
CCLD xusb
xusb.o(.text+0x10a3): In function `main':
/home/mcuee/Desktop/build/libusbx/libusbx-1.0.11-rc1/examples/xusb.c:781:
warning: strcat() is almost always misused, please use strlcat()
I am also testing with OpenBSD 5.1 (installed using i386/install51.iso),
and I'm not seeing the warning ATM.
What did you use to install your OpenBSD platform?
I don't think switching to strlcat is something we want to go through
especially as it doesn't seem to be part of string.h on Linux and isn't
mentioned in the manpages there either.
If achievable, I wouldn't have minded silencing the warning with a gcc
option, but what I'm reading [1] seem to indicate that these are
generated from a libc compiled with APIWARN defined, and thus one cannot
silence those without recompiling libc...
I guess the only option left is to remove the strcat call altogether,
which doesn't seem too difficult. Can you apply the attached patch on
your OpenBSD platform and confirm the warning goes away?
Regards
[1] http://www.daemonforums.org/showthread.php?t=6249
>From 9247468c515c40a32a509da1b96d269b23f802e3 Mon Sep 17 00:00:00 2001
From: Pete Batard <p...@akeo.ie>
Date: Mon, 7 May 2012 15:41:50 +0100
Subject: [PATCH] Samples: fix strcat vs strlcat warning on OpenBSD
* Without this, OpenBSD produces the following warning:
strcat() is almost always misused, please use strlcat()
---
examples/xusb.c | 3 +--
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/examples/xusb.c b/examples/xusb.c
index a98ebb4..c811353 100644
--- a/examples/xusb.c
+++ b/examples/xusb.c
@@ -54,7 +54,7 @@
// Global variables
bool binary_dump = false;
-char binary_name[64];
+char binary_name[64] = "raw.bin";
static int perr(char const *format, ...)
{
@@ -778,7 +778,6 @@ int main(int argc, char** argv)
debug_mode = true;
break;
case 'b':
- strcat(binary_name, "raw.bin");
if (j+1 < argc) {
strncpy(binary_name, argv[j+1],
64);
j++;
--
1.7.9.msysgit.0
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel