[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1540827471.29722.9.camel@debian.org>
Date: Mon, 29 Oct 2018 15:37:51 +0000
From: Luca Boccassi <bluca@...ian.org>
To: David Ahern <dsahern@...il.com>, netdev@...r.kernel.org
Cc: stephen@...workplumber.org
Subject: Re: [PATCH iproute2] Use libbsd for strlcpy if available
On Mon, 2018-10-29 at 09:27 -0600, David Ahern wrote:
> On 10/29/18 4:46 AM, Luca Boccassi wrote:
> > If libc does not provide strlcpy check for libbsd with pkg-config
> > to
> > avoid relying on inline version.
> >
> > Signed-off-by: Luca Boccassi <bluca@...ian.org>
> > ---
> > This allows distro maintainers to be able to choose to reduce
> > duplication and let this code be maintained in one place, in the
> > external library.
> >
> > configure | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 744d6282..1dd9ce84 100755
> > --- a/configure
> > +++ b/configure
> > @@ -330,8 +330,16 @@ EOF
> > then
> > echo "no"
> > else
> > - echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
> > - echo "yes"
> > + if ${PKG_CONFIG} libbsd --exists
> > + then
> > + echo 'CFLAGS += -include' `${PKG_CONFIG} libbsd --
> > variable=includedir`'/bsd/string.h' \
> > + `${PKG_CONFIG} libbsd --cflags` >>$CONFIG
> > + echo 'LDLIBS +=' `${PKG_CONFIG} libbsd --libs` >>
> > $CONFIG
> > + echo "no"
> > + else
> > + echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
> > + echo "yes"
> > + fi
> > fi
> > rm -f $TMPDIR/strtest.c $TMPDIR/strtest
> > }
> >
>
> How long has libbsd had an implementation of strlcpy? Would be safer
> to
> have a compile test to verify libbsd has it.
Hi,
0.0 from 10+ years ago has it, so I think we are safe :-)
https://gitlab.freedesktop.org/libbsd/libbsd/blob/0.0/include/bsd/string.h#L34
--
Kind regards,
Luca Boccassi
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists