netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Boccassi <bluca@debian.org>
To: David Ahern <dsahern@gmail.com>, netdev@vger.kernel.org
Cc: stephen@networkplumber.org
Subject: Re: [PATCH iproute2] Use libbsd for strlcpy if available
Date: Mon, 29 Oct 2018 15:37:51 +0000	[thread overview]
Message-ID: <1540827471.29722.9.camel@debian.org> (raw)
In-Reply-To: <78a4e635-1675-a92d-e7ba-ffc4a642b901@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]

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@debian.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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-10-30  0:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 10:46 [PATCH iproute2] Use libbsd for strlcpy if available Luca Boccassi
2018-10-29 15:27 ` David Ahern
2018-10-29 15:37   ` Luca Boccassi [this message]
2018-10-31 15:09 ` Stephen Hemminger
2018-10-31 17:54   ` Luca Boccassi
2018-10-31 18:00 ` [PATCH iproute2 v2] " Luca Boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540827471.29722.9.camel@debian.org \
    --to=bluca@debian.org \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).