net/libbgpdump: fix build with clang

PR:		191428
Submitted by:	mjl@luckie.org.nz (maintainer)
This commit is contained in:
Kurt Jaeger 2014-08-15 20:24:06 +00:00
parent 9d0d07d4cf
commit fdff402b8c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=365034
2 changed files with 30 additions and 3 deletions

View File

@ -1,9 +1,8 @@
# Created by: ijliao
# $FreeBSD$
PORTNAME= libbgpdump
PORTVERSION= 1.4.99.13
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= net
MASTER_SITES= http://www.ris.ripe.net/source/bgpdump/
EXTRACT_SUFX= .tgz
@ -15,7 +14,6 @@ LICENSE= GPLv2
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
USE_GCC= any
OPTIONS_DEFINE= DOCS EXAMPLES

View File

@ -0,0 +1,29 @@
--- util.c.orig 2014-08-15 12:58:56.000000000 -0700
+++ util.c 2014-08-15 13:01:14.000000000 -0700
@@ -29,6 +29,7 @@
#include <syslog.h>
#include <time.h>
#include <string.h>
+#include <inttypes.h>
static bool use_syslog = true;
@@ -110,17 +111,7 @@
int int2str(uint32_t value, char* str)
{
- const int LEN = 11;
- char b[LEN];
- int i = LEN;
- b[i--] = '\0';
-
- do {
- b[i--] = (char)(48 + (value % 10));
- } while (value /= 10);
-
- memcpy(str, b + i + 1, LEN - i);
- return LEN - i - 1;
+ return snprintf(str, 11, "%"PRIu32, value);
}
static void ti2s(uint32_t value) {