linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
@ 2010-10-20 21:35 Jim Rees
       [not found] ` <20101020213554.GA27541-8f4Pc2RrbJmHXe+LvDLADg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Rees @ 2010-10-20 21:35 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs

Signed-off-by: Jim Rees <rees@umich.edu>
---
 configure.ac             |    2 +-
 support/include/nfslib.h |    2 ++
 support/nfs/strlcat.c    |    2 ++
 support/nfs/strlcpy.c    |    2 ++
 4 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3058be6..0e56b30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -347,7 +347,7 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \
                getnameinfo getrpcbyname getifaddrs \
                gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \
                realpath rmdir select socket strcasecmp strchr strdup \
-               strerror strrchr strtol strtoul sigprocmask])
+               strerror strlcat strrchr strtol strtoul sigprocmask])
 
 
 dnl *************************************************************
diff --git a/support/include/nfslib.h b/support/include/nfslib.h
index 53ece0e..ba2d52a 100644
--- a/support/include/nfslib.h
+++ b/support/include/nfslib.h
@@ -164,8 +164,10 @@ int			svctcp_socket (u_long __number, int __reuse);
 int			svcudp_socket (u_long __number);
 
 /* Misc shared code prototypes */
+#ifndef HAVE_STRLCAT
 size_t  strlcat(char *, const char *, size_t);
 size_t  strlcpy(char *, const char *, size_t);
+#endif /* HAVE_STRLCAT */
 ssize_t atomicio(ssize_t (*f) (int, void*, size_t),
 		 int, void *, size_t);
 
diff --git a/support/nfs/strlcat.c b/support/nfs/strlcat.c
index daedd7a..d469a69 100644
--- a/support/nfs/strlcat.c
+++ b/support/nfs/strlcat.c
@@ -27,6 +27,7 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef HAVE_STRLCAT
 #if defined(LIBC_SCCS) && !defined(lint)
 static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $";
 #endif /* LIBC_SCCS and not lint */
@@ -74,3 +75,4 @@ strlcat(char *dst,
 
 	return(dlen + (s - src));	/* count does not include NUL */
 }
+#endif /* HAVE_STRLCAT */
diff --git a/support/nfs/strlcpy.c b/support/nfs/strlcpy.c
index a2653ee..754c51a 100644
--- a/support/nfs/strlcpy.c
+++ b/support/nfs/strlcpy.c
@@ -27,6 +27,7 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef HAVE_STRLCAT
 #if defined(LIBC_SCCS) && !defined(lint)
 static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $";
 #endif /* LIBC_SCCS and not lint */
@@ -70,3 +71,4 @@ strlcpy(char *dst,
 
 	return(s - src - 1);	/* count does not include NUL */
 }
+#endif /* HAVE_STRLCAT */
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
       [not found] ` <20101020213554.GA27541-8f4Pc2RrbJmHXe+LvDLADg@public.gmane.org>
@ 2010-10-21  2:14   ` Christoph Hellwig
  2010-10-21 12:01     ` Jim Rees
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2010-10-21  2:14 UTC (permalink / raw)
  To: Jim Rees; +Cc: Steve Dickson, linux-nfs

Not that I'd complain, but what Linux libc provides strlcat/cpy?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
  2010-10-21  2:14   ` Christoph Hellwig
@ 2010-10-21 12:01     ` Jim Rees
  2010-10-21 12:40       ` Christoph Hellwig
  2010-10-28 13:40       ` Steve Dickson
  0 siblings, 2 replies; 6+ messages in thread
From: Jim Rees @ 2010-10-21 12:01 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Steve Dickson, linux-nfs

Christoph Hellwig wrote:

  Not that I'd complain, but what Linux libc provides strlcat/cpy?

None that I know of.  The patch seems like a good idea to me, but it does
add a couple of ugly ifdefs to the include file.

There are already quite a few much sillier checks in configure.ac, like
memset, socket, and mkdir.

But I won't object if you want to drop this patch.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
  2010-10-21 12:01     ` Jim Rees
@ 2010-10-21 12:40       ` Christoph Hellwig
  2010-10-28 13:40       ` Steve Dickson
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2010-10-21 12:40 UTC (permalink / raw)
  To: Jim Rees; +Cc: Christoph Hellwig, Steve Dickson, linux-nfs

On Thu, Oct 21, 2010 at 08:01:10AM -0400, Jim Rees wrote:
> Christoph Hellwig wrote:
> 
>   Not that I'd complain, but what Linux libc provides strlcat/cpy?
> 
> None that I know of.  The patch seems like a good idea to me, but it does
> add a couple of ugly ifdefs to the include file.
> 
> There are already quite a few much sillier checks in configure.ac, like
> memset, socket, and mkdir.
> 
> But I won't object if you want to drop this patch.

I'm just wondering why you submit it.  Do you plan to port nfs-utils to
a non-Linux system?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
  2010-10-21 12:01     ` Jim Rees
  2010-10-21 12:40       ` Christoph Hellwig
@ 2010-10-28 13:40       ` Steve Dickson
  2010-10-28 15:59         ` Jim Rees
  1 sibling, 1 reply; 6+ messages in thread
From: Steve Dickson @ 2010-10-28 13:40 UTC (permalink / raw)
  To: Jim Rees; +Cc: Christoph Hellwig, linux-nfs

On 10/21/2010 08:01 AM, Jim Rees wrote:
> Christoph Hellwig wrote:
> 
>   Not that I'd complain, but what Linux libc provides strlcat/cpy?
> 
> None that I know of.  The patch seems like a good idea to me, but it does
> add a couple of ugly ifdefs to the include file.
> 
> There are already quite a few much sillier checks in configure.ac, like
> memset, socket, and mkdir.
> 
> But I won't object if you want to drop this patch.
I think if/when there is a need for these checks we
can add them in then... Why add to the ugliness
if we don't need to?  

steved.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
  2010-10-28 13:40       ` Steve Dickson
@ 2010-10-28 15:59         ` Jim Rees
  0 siblings, 0 replies; 6+ messages in thread
From: Jim Rees @ 2010-10-28 15:59 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Christoph Hellwig, linux-nfs

Steve Dickson wrote:

  On 10/21/2010 08:01 AM, Jim Rees wrote:
  > Christoph Hellwig wrote:
  > 
  >   Not that I'd complain, but what Linux libc provides strlcat/cpy?
  > 
  > None that I know of.  The patch seems like a good idea to me, but it does
  > add a couple of ugly ifdefs to the include file.
  > 
  > There are already quite a few much sillier checks in configure.ac, like
  > memset, socket, and mkdir.
  > 
  > But I won't object if you want to drop this patch.
  I think if/when there is a need for these checks we
  can add them in then... Why add to the ugliness
  if we don't need to?  

Fine with me.  I was feeling guilty because I think I'm the one who
originally put the strlcat/cpy calls in, way back when idmapd did run on
non-linux platforms.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-28 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 21:35 [PATCH] nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed Jim Rees
     [not found] ` <20101020213554.GA27541-8f4Pc2RrbJmHXe+LvDLADg@public.gmane.org>
2010-10-21  2:14   ` Christoph Hellwig
2010-10-21 12:01     ` Jim Rees
2010-10-21 12:40       ` Christoph Hellwig
2010-10-28 13:40       ` Steve Dickson
2010-10-28 15:59         ` Jim Rees

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).