nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
Subsystems (2)
PATCH 1/1 nfs-utils: Check for strlcat/cpy and compile our private version only if it's needed.
--- 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(-)
configure.ac +1 -1
@@ -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 *************************************************************
support/include/nfslib.h +2 -0
@@ -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 );
support/nfs/strlcat.c +2 -0
@@ -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 */
support/nfs/strlcpy.c +2 -0
@@ -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 */
Signature · 1 line
1.7.0.4
Not that I'd complain, but what Linux libc provides strlcat/cpy?
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.
Quoted 11 lines · Jim Rees
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?
Quoted 11 lines · Jim Rees
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.
Steve Dickson wrote:
Quoted 11 lines · Jim Rees
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.