7 changed files with 344 additions and 231 deletions
			
			
		| @ -0,0 +1,33 @@ | |||
| --- a/utils/mount/network.c
 | |||
| +++ b/utils/mount/network.c
 | |||
| @@ -39,12 +39,14 @@
 | |||
|  #include <sys/socket.h> | |||
|  #include <sys/wait.h> | |||
|  #include <sys/stat.h> | |||
| +#ifdef IPV6_SUPPORTED
 | |||
|  #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)) | |||
|  /* Cannot safely include linux/in6.h in old glibc, so hardcode the needed values */ | |||
|  # define IPV6_PREFER_SRC_PUBLIC 2 | |||
|  # define IPV6_ADDR_PREFERENCES 72 | |||
|  #else | |||
|  # include <linux/in6.h> | |||
| +#endif
 | |||
|  #endif | |||
|  #include <netinet/in.h> | |||
|  #include <rpc/rpc.h> | |||
| @@ -1123,6 +1125,7 @@
 | |||
|  		if (bind(sock, SAFE_SOCKADDR(&sin), sizeof(sin)) < 0) | |||
|  			goto out; | |||
|  		break; | |||
| +#ifdef IPV6_SUPPORTED
 | |||
|  	case AF_INET6: | |||
|  		/* Make sure the call-back address is public/permanent */ | |||
|  		val = IPV6_PREFER_SRC_PUBLIC; | |||
| @@ -1130,6 +1133,7 @@
 | |||
|  		if (bind(sock, SAFE_SOCKADDR(&sin6), sizeof(sin6)) < 0) | |||
|  			goto out; | |||
|  		break; | |||
| +#endif
 | |||
|  	default: | |||
|  		errno = EAFNOSUPPORT; | |||
|  		goto out; | |||
| @ -0,0 +1,299 @@ | |||
| From 690a90a5b7786e40b5447ad7c5f19a7657d27405 Mon Sep 17 00:00:00 2001 | |||
| From: Mingli Yu <Mingli.Yu@windriver.com> | |||
| Date: Fri, 14 Dec 2018 17:44:32 +0800 | |||
| Subject: [PATCH] Makefile.am: fix undefined function for libnsm.a | |||
| 
 | |||
| The source file of libnsm.a uses some function | |||
| in ../support/misc/file.c, add ../support/misc/file.c | |||
| to libnsm_a_SOURCES to fix build error when run | |||
| "make -C tests statdb_dump": | |||
| | ../support/nsm/libnsm.a(file.o): In function `nsm_make_pathname': | |||
| | /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname' | |||
| | /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname' | |||
| | /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname' | |||
| | ../support/nsm/libnsm.a(file.o): In function `nsm_setup_pathnames': | |||
| | /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:280: undefined reference to `generic_setup_basedir' | |||
| | collect2: error: ld returned 1 exit status | |||
| 
 | |||
| As there is already one source file named file.c | |||
| as support/nsm/file.c in support/nsm/Makefile.am, | |||
| so rename ../support/misc/file.c to ../support/misc/misc.c. | |||
| 
 | |||
| Upstream-Status: Submitted[https://marc.info/?l=linux-nfs&m=154502780423058&w=2] | |||
| 
 | |||
| Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> | |||
| 
 | |||
| Rebase it. | |||
| 
 | |||
| Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | |||
| ---
 | |||
|  support/misc/Makefile.am |   2 +- | |||
|  support/misc/file.c      | 115 --------------------------------------------------------------------------------------------------------------- | |||
|  support/misc/misc.c      | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |||
|  support/nsm/Makefile.am  |   2 +- | |||
|  4 files changed, 113 insertions(+), 117 deletions(-) | |||
| 
 | |||
| diff --git a/support/misc/Makefile.am b/support/misc/Makefile.am
 | |||
| index f9993e3..8b0e9db 100644
 | |||
| --- a/support/misc/Makefile.am
 | |||
| +++ b/support/misc/Makefile.am
 | |||
| @@ -1,7 +1,7 @@
 | |||
|  ## Process this file with automake to produce Makefile.in | |||
|   | |||
|  noinst_LIBRARIES = libmisc.a | |||
| -libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c file.c \
 | |||
| +libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c misc.c \
 | |||
|  		    nfsd_path.c workqueue.c xstat.c | |||
|   | |||
|  MAINTAINERCLEANFILES = Makefile.in | |||
| diff --git a/support/misc/file.c b/support/misc/file.c
 | |||
| deleted file mode 100644 | |||
| index 06f6bb2..0000000
 | |||
| --- a/support/misc/file.c
 | |||
| +++ /dev/null
 | |||
| @@ -1,115 +0,0 @@
 | |||
| -/*
 | |||
| - * Copyright 2009 Oracle.  All rights reserved.
 | |||
| - * Copyright 2017 Red Hat, Inc.  All rights reserved.
 | |||
| - *
 | |||
| - * This file is part of nfs-utils.
 | |||
| - *
 | |||
| - * nfs-utils is free software; you can redistribute it and/or modify
 | |||
| - * it under the terms of the GNU General Public License as published by
 | |||
| - * the Free Software Foundation; either version 2 of the License, or
 | |||
| - * (at your option) any later version.
 | |||
| - *
 | |||
| - * nfs-utils is distributed in the hope that it will be useful,
 | |||
| - * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |||
| - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |||
| - * GNU General Public License for more details.
 | |||
| - *
 | |||
| - * You should have received a copy of the GNU General Public License
 | |||
| - * along with nfs-utils.  If not, see <http://www.gnu.org/licenses/>.
 | |||
| - */
 | |||
| -
 | |||
| -#ifdef HAVE_CONFIG_H
 | |||
| -#include <config.h>
 | |||
| -#endif
 | |||
| -
 | |||
| -#include <sys/stat.h>
 | |||
| -
 | |||
| -#include <string.h>
 | |||
| -#include <libgen.h>
 | |||
| -#include <stdio.h>
 | |||
| -#include <errno.h>
 | |||
| -#include <dirent.h>
 | |||
| -#include <stdlib.h>
 | |||
| -#include <stdbool.h>
 | |||
| -#include <limits.h>
 | |||
| -
 | |||
| -#include "xlog.h"
 | |||
| -#include "misc.h"
 | |||
| -
 | |||
| -/*
 | |||
| - * Returns a dynamically allocated, '\0'-terminated buffer
 | |||
| - * containing an appropriate pathname, or NULL if an error
 | |||
| - * occurs.  Caller must free the returned result with free(3).
 | |||
| - */
 | |||
| -__attribute__((__malloc__))
 | |||
| -char *
 | |||
| -generic_make_pathname(const char *base, const char *leaf)
 | |||
| -{
 | |||
| -	size_t size;
 | |||
| -	char *path;
 | |||
| -	int len;
 | |||
| -
 | |||
| -	size = strlen(base) + strlen(leaf) + 2;
 | |||
| -	if (size > PATH_MAX)
 | |||
| -		return NULL;
 | |||
| -
 | |||
| -	path = malloc(size);
 | |||
| -	if (path == NULL)
 | |||
| -		return NULL;
 | |||
| -
 | |||
| -	len = snprintf(path, size, "%s/%s", base, leaf);
 | |||
| -	if ((len < 0) || ((size_t)len >= size)) {
 | |||
| -		free(path);
 | |||
| -		return NULL;
 | |||
| -	}
 | |||
| -
 | |||
| -	return path;
 | |||
| -}
 | |||
| -
 | |||
| -
 | |||
| -/**
 | |||
| - * generic_setup_basedir - set up basedir
 | |||
| - * @progname: C string containing name of program, for error messages
 | |||
| - * @parentdir: C string containing pathname to on-disk state, or NULL
 | |||
| - * @base: character buffer to contain the basedir that is set up
 | |||
| - * @baselen: size of @base in bytes
 | |||
| - *
 | |||
| - * This runs before logging is set up, so error messages are directed
 | |||
| - * to stderr.
 | |||
| - *
 | |||
| - * Returns true and sets up our basedir, if @parentdir was valid
 | |||
| - * and usable; otherwise false is returned.
 | |||
| - */
 | |||
| -_Bool
 | |||
| -generic_setup_basedir(const char *progname, const char *parentdir, char *base,
 | |||
| -		      const size_t baselen)
 | |||
| -{
 | |||
| -	static char buf[PATH_MAX];
 | |||
| -	struct stat st;
 | |||
| -	char *path;
 | |||
| -
 | |||
| -	/* First: test length of name and whether it exists */
 | |||
| -	if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
 | |||
| -		(void)fprintf(stderr, "%s: Directory name too long: %s",
 | |||
| -				progname, parentdir);
 | |||
| -		return false;
 | |||
| -	}
 | |||
| -	if (lstat(parentdir, &st) == -1) {
 | |||
| -		(void)fprintf(stderr, "%s: Failed to stat %s: %s",
 | |||
| -				progname, parentdir, strerror(errno));
 | |||
| -		return false;
 | |||
| -	}
 | |||
| -
 | |||
| -	/* Ensure we have a clean directory pathname */
 | |||
| -	strncpy(buf, parentdir, sizeof(buf)-1);
 | |||
| -	path = dirname(buf);
 | |||
| -	if (*path == '.') {
 | |||
| -		(void)fprintf(stderr, "%s: Unusable directory %s",
 | |||
| -				progname, parentdir);
 | |||
| -		return false;
 | |||
| -	}
 | |||
| -
 | |||
| -	xlog(D_CALL, "Using %s as the state directory", parentdir);
 | |||
| -	strcpy(base, parentdir);
 | |||
| -	return true;
 | |||
| -}
 | |||
| diff --git a/support/misc/misc.c b/support/misc/misc.c
 | |||
| new file mode 100644 | |||
| index 0000000..e7c3819
 | |||
| --- /dev/null
 | |||
| +++ b/support/misc/misc.c
 | |||
| @@ -0,0 +1,111 @@
 | |||
| +/*
 | |||
| + * Copyright 2009 Oracle.  All rights reserved.
 | |||
| + * Copyright 2017 Red Hat, Inc.  All rights reserved.
 | |||
| + *
 | |||
| + * This file is part of nfs-utils.
 | |||
| + *
 | |||
| + * nfs-utils is free software; you can redistribute it and/or modify
 | |||
| + * it under the terms of the GNU General Public License as published by
 | |||
| + * the Free Software Foundation; either version 2 of the License, or
 | |||
| + * (at your option) any later version.
 | |||
| + *
 | |||
| + * nfs-utils is distributed in the hope that it will be useful,
 | |||
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |||
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |||
| + * GNU General Public License for more details.
 | |||
| + *
 | |||
| + * You should have received a copy of the GNU General Public License
 | |||
| + * along with nfs-utils.  If not, see <http://www.gnu.org/licenses/>.
 | |||
| + */
 | |||
| +
 | |||
| +#include <sys/stat.h>
 | |||
| +
 | |||
| +#include <string.h>
 | |||
| +#include <libgen.h>
 | |||
| +#include <stdio.h>
 | |||
| +#include <errno.h>
 | |||
| +#include <dirent.h>
 | |||
| +#include <stdlib.h>
 | |||
| +#include <stdbool.h>
 | |||
| +#include <limits.h>
 | |||
| +
 | |||
| +#include "xlog.h"
 | |||
| +#include "misc.h"
 | |||
| +
 | |||
| +/*
 | |||
| + * Returns a dynamically allocated, '\0'-terminated buffer
 | |||
| + * containing an appropriate pathname, or NULL if an error
 | |||
| + * occurs.  Caller must free the returned result with free(3).
 | |||
| + */
 | |||
| +__attribute__((__malloc__))
 | |||
| +char *
 | |||
| +generic_make_pathname(const char *base, const char *leaf)
 | |||
| +{
 | |||
| +	size_t size;
 | |||
| +	char *path;
 | |||
| +	int len;
 | |||
| +
 | |||
| +	size = strlen(base) + strlen(leaf) + 2;
 | |||
| +	if (size > PATH_MAX)
 | |||
| +		return NULL;
 | |||
| +
 | |||
| +	path = malloc(size);
 | |||
| +	if (path == NULL)
 | |||
| +		return NULL;
 | |||
| +
 | |||
| +	len = snprintf(path, size, "%s/%s", base, leaf);
 | |||
| +	if ((len < 0) || ((size_t)len >= size)) {
 | |||
| +		free(path);
 | |||
| +		return NULL;
 | |||
| +	}
 | |||
| +
 | |||
| +	return path;
 | |||
| +}
 | |||
| +
 | |||
| +
 | |||
| +/**
 | |||
| + * generic_setup_basedir - set up basedir
 | |||
| + * @progname: C string containing name of program, for error messages
 | |||
| + * @parentdir: C string containing pathname to on-disk state, or NULL
 | |||
| + * @base: character buffer to contain the basedir that is set up
 | |||
| + * @baselen: size of @base in bytes
 | |||
| + *
 | |||
| + * This runs before logging is set up, so error messages are directed
 | |||
| + * to stderr.
 | |||
| + *
 | |||
| + * Returns true and sets up our basedir, if @parentdir was valid
 | |||
| + * and usable; otherwise false is returned.
 | |||
| + */
 | |||
| +_Bool
 | |||
| +generic_setup_basedir(const char *progname, const char *parentdir, char *base,
 | |||
| +		      const size_t baselen)
 | |||
| +{
 | |||
| +	static char buf[PATH_MAX];
 | |||
| +	struct stat st;
 | |||
| +	char *path;
 | |||
| +
 | |||
| +	/* First: test length of name and whether it exists */
 | |||
| +	if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
 | |||
| +		(void)fprintf(stderr, "%s: Directory name too long: %s",
 | |||
| +				progname, parentdir);
 | |||
| +		return false;
 | |||
| +	}
 | |||
| +	if (lstat(parentdir, &st) == -1) {
 | |||
| +		(void)fprintf(stderr, "%s: Failed to stat %s: %s",
 | |||
| +				progname, parentdir, strerror(errno));
 | |||
| +		return false;
 | |||
| +	}
 | |||
| +
 | |||
| +	/* Ensure we have a clean directory pathname */
 | |||
| +	strncpy(buf, parentdir, sizeof(buf)-1);
 | |||
| +	path = dirname(buf);
 | |||
| +	if (*path == '.') {
 | |||
| +		(void)fprintf(stderr, "%s: Unusable directory %s",
 | |||
| +				progname, parentdir);
 | |||
| +		return false;
 | |||
| +	}
 | |||
| +
 | |||
| +	xlog(D_CALL, "Using %s as the state directory", parentdir);
 | |||
| +	strcpy(base, parentdir);
 | |||
| +	return true;
 | |||
| +}
 | |||
| diff --git a/support/nsm/Makefile.am b/support/nsm/Makefile.am
 | |||
| index 8f5874e..68f1a46 100644
 | |||
| --- a/support/nsm/Makefile.am
 | |||
| +++ b/support/nsm/Makefile.am
 | |||
| @@ -10,7 +10,7 @@ GENFILES	= $(GENFILES_CLNT) $(GENFILES_SVC) $(GENFILES_XDR) $(GENFILES_H)
 | |||
|  EXTRA_DIST	= sm_inter.x | |||
|   | |||
|  noinst_LIBRARIES = libnsm.a | |||
| -libnsm_a_SOURCES = $(GENFILES) file.c rpc.c
 | |||
| +libnsm_a_SOURCES = $(GENFILES) ../misc/misc.c file.c rpc.c
 | |||
|   | |||
|  BUILT_SOURCES = $(GENFILES) | |||
|   | |||
| @ -1,60 +0,0 @@ | |||
| From 5796ca01e33596d4102dd714349c908fecc331c0 Mon Sep 17 00:00:00 2001 | |||
| From: Gustavo Zacarias <gustavo@zacarias.com.ar> | |||
| Date: Sat, 10 Nov 2012 18:56:12 +0100 | |||
| Subject: [PATCH] Patch taken from Gentoo | |||
| 
 | |||
| Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> | |||
| ---
 | |||
|  tools/locktest/Makefile.am | 7 +++---- | |||
|  tools/rpcgen/Makefile.am   | 8 +++----- | |||
|  2 files changed, 6 insertions(+), 9 deletions(-) | |||
| 
 | |||
| diff --git a/tools/locktest/Makefile.am b/tools/locktest/Makefile.am
 | |||
| index 3156815..efe6fcd 100644
 | |||
| --- a/tools/locktest/Makefile.am
 | |||
| +++ b/tools/locktest/Makefile.am
 | |||
| @@ -1,12 +1,11 @@
 | |||
|  ## Process this file with automake to produce Makefile.in | |||
| 
 | |||
|  CC=$(CC_FOR_BUILD) | |||
| -LIBTOOL = @LIBTOOL@ --tag=CC
 | |||
| +CFLAGS=$(CFLAGS_FOR_BUILD)
 | |||
| +CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
 | |||
| +LDFLAGS=$(LDFLAGS_FOR_BUILD)
 | |||
| 
 | |||
|  noinst_PROGRAMS = testlk | |||
|  testlk_SOURCES = testlk.c | |||
| -testlk_CFLAGS=$(CFLAGS_FOR_BUILD)
 | |||
| -testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
 | |||
| -testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD)
 | |||
| 
 | |||
|  MAINTAINERCLEANFILES = Makefile.in | |||
| diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am
 | |||
| index 8a9ec89..5a5b4d3 100644
 | |||
| --- a/tools/rpcgen/Makefile.am
 | |||
| +++ b/tools/rpcgen/Makefile.am
 | |||
| @@ -1,7 +1,9 @@
 | |||
|  ## Process this file with automake to produce Makefile.in | |||
| 
 | |||
|  CC=$(CC_FOR_BUILD) | |||
| -LIBTOOL = @LIBTOOL@ --tag=CC
 | |||
| +CFLAGS=$(CFLAGS_FOR_BUILD)
 | |||
| +CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
 | |||
| +LDFLAGS=$(LDFLAGS_FOR_BUILD)
 | |||
| 
 | |||
|  noinst_PROGRAMS = rpcgen | |||
|  rpcgen_SOURCES = rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c \ | |||
| @@ -9,10 +11,6 @@ rpcgen_SOURCES = rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c \
 | |||
|  		 rpc_util.c rpc_sample.c rpc_output.h rpc_parse.h \ | |||
|  		 rpc_scan.h rpc_util.h | |||
| 
 | |||
| -rpcgen_CFLAGS=$(CFLAGS_FOR_BUILD)
 | |||
| -rpcgen_CPPLAGS=$(CPPFLAGS_FOR_BUILD)
 | |||
| -rpcgen_LDFLAGS=$(LDFLAGS_FOR_BUILD)
 | |||
| -rpcgen_LDADD=$(LIBTIRPC)
 | |||
| 
 | |||
|  MAINTAINERCLEANFILES = Makefile.in | |||
| 
 | |||
| --
 | |||
| 2.1.0 | |||
| 
 | |||
| @ -1,72 +0,0 @@ | |||
| From a1d45736286939b822fcc7b9c74843f6f90a747e Mon Sep 17 00:00:00 2001 | |||
| From: Gustavo Zacarias <gustavo@zacarias.com.ar> | |||
| Date: Sat, 10 Nov 2012 18:58:15 +0100 | |||
| Subject: [PATCH] Switch legacy index() in favour of strchr() Updated for 1.2.6 | |||
|  from the previous patch by Frederik Pasch. | |||
| 
 | |||
| Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> | |||
| ---
 | |||
|  support/nfs/nfs_mntent.c | 6 +++--- | |||
|  utils/mount/error.c      | 2 +- | |||
|  utils/mountd/fsloc.c     | 2 +- | |||
|  3 files changed, 5 insertions(+), 5 deletions(-) | |||
| 
 | |||
| diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
 | |||
| index a2118a2..7496ed6 100644
 | |||
| --- a/support/nfs/nfs_mntent.c
 | |||
| +++ b/support/nfs/nfs_mntent.c
 | |||
| @@ -9,7 +9,7 @@
 | |||
|   */ | |||
| 
 | |||
|  #include <stdio.h> | |||
| -#include <string.h>		/* for index */
 | |||
| +#include <string.h>		/* for strchr */
 | |||
|  #include <ctype.h>		/* for isdigit */ | |||
|  #include <sys/stat.h>		/* for umask */ | |||
|  #include <unistd.h>		/* for ftruncate */ | |||
| @@ -172,7 +172,7 @@ nfs_getmntent (mntFILE *mfp) {
 | |||
|  			return NULL; | |||
| 
 | |||
|  		mfp->mntent_lineno++; | |||
| -		s = index (buf, '\n');
 | |||
| +		s = strchr (buf, '\n');
 | |||
|  		if (s == NULL) { | |||
|  			/* Missing final newline?  Otherwise extremely */ | |||
|  			/* long line - assume file was corrupted */ | |||
| @@ -180,7 +180,7 @@ nfs_getmntent (mntFILE *mfp) {
 | |||
|  				fprintf(stderr, _("[mntent]: warning: no final " | |||
|  					"newline at the end of %s\n"), | |||
|  					mfp->mntent_file); | |||
| -				s = index (buf, 0);
 | |||
| +				s = strchr (buf, 0);
 | |||
|  			} else { | |||
|  				mfp->mntent_errs = 1; | |||
|  				goto err; | |||
| diff --git a/utils/mount/error.c b/utils/mount/error.c
 | |||
| index e06f598..7bd1d27 100644
 | |||
| --- a/utils/mount/error.c
 | |||
| +++ b/utils/mount/error.c
 | |||
| @@ -62,7 +62,7 @@ static int rpc_strerror(int spos)
 | |||
|  	char *tmp; | |||
| 
 | |||
|  	if (estr) { | |||
| -		if ((ptr = index(estr, ':')))
 | |||
| +		if ((ptr = strchr(estr, ':')))
 | |||
|  			estr = ++ptr; | |||
| 
 | |||
|  		tmp = &errbuf[spos]; | |||
| diff --git a/utils/mountd/fsloc.c b/utils/mountd/fsloc.c
 | |||
| index bc737d1..ddbe92f 100644
 | |||
| --- a/utils/mountd/fsloc.c
 | |||
| +++ b/utils/mountd/fsloc.c
 | |||
| @@ -127,7 +127,7 @@ static struct servers *method_list(char *data)
 | |||
|  	bool v6esc = false; | |||
| 
 | |||
|  	xlog(L_NOTICE, "method_list(%s)", data); | |||
| -	for (ptr--, listsize=1; ptr; ptr=index(ptr, ':'), listsize++)
 | |||
| +	for (ptr--, listsize=1; ptr; ptr=strchr(ptr, ':'), listsize++)
 | |||
|  		ptr++; | |||
|  	list = malloc(listsize * sizeof(char *)); | |||
|  	copy = strdup(data); | |||
| --
 | |||
| 2.1.0 | |||
| @ -1,46 +0,0 @@ | |||
| From 87f88b28ac01b6449463f00b660fe7416d7f9a55 Mon Sep 17 00:00:00 2001 | |||
| From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | |||
| Date: Sat, 10 Nov 2012 18:53:03 +0100 | |||
| Subject: [PATCH] Let the configure script find getrpcbynumber in libtirpc | |||
| 
 | |||
| The getrpcbynumber() function may not be available in the C library, | |||
| but only in the libtirpc library. Take this into account when checking | |||
| for the existence of getrpcbynumber() and getrpcbynumber_r(). | |||
| 
 | |||
| Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | |||
| ---
 | |||
|  configure.ac | 14 +++++++++++++- | |||
|  1 file changed, 13 insertions(+), 1 deletion(-) | |||
| 
 | |||
| diff --git a/configure.ac b/configure.ac
 | |||
| index 8e427e3..6e42c96 100644
 | |||
| --- a/configure.ac
 | |||
| +++ b/configure.ac
 | |||
| @@ -433,11 +433,23 @@ AC_FUNC_STAT
 | |||
|  AC_FUNC_VPRINTF | |||
|  AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \ | |||
|                 gethostbyaddr gethostbyname gethostname getmntent \ | |||
| -               getnameinfo getrpcbyname getrpcbynumber getrpcbynumber_r getifaddrs \
 | |||
| +               getnameinfo getrpcbyname getifaddrs \
 | |||
|                 gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \ | |||
|                 ppoll realpath rmdir select socket strcasecmp strchr strdup \ | |||
|                 strerror strrchr strtol strtoul sigprocmask name_to_handle_at]) | |||
| 
 | |||
| +save_CFLAGS=$CFLAGS
 | |||
| +save_LIBS=$LIBS
 | |||
| +CFLAGS="$CFLAGS $AM_CPPFLAGS"
 | |||
| +LIBS="$LIBS $LIBTIRPC"
 | |||
| +AC_CHECK_FUNCS([getrpcbynumber getrpcbynumber_r])
 | |||
| +CFLAGS=$save_CFLAGS
 | |||
| +LIBS=$save_LIBS
 | |||
| +
 | |||
| +if test "$ac_cv_func_getrpcbynumber_r" != "yes" -a "$ac_cv_func_getrpcbynumber" != "yes"; then
 | |||
| +   AC_MSG_ERROR([Neither getrpcbynumber_r nor getrpcbynumber are available])
 | |||
| +fi
 | |||
| +
 | |||
|  dnl ************************************************************* | |||
|  dnl Check for data sizes | |||
|  dnl ************************************************************* | |||
| --
 | |||
| 2.1.0 | |||
| 
 | |||
| @ -1,46 +0,0 @@ | |||
| From 3c23b3ea7f5069e8fd4d5758704cd968504f1079 Mon Sep 17 00:00:00 2001 | |||
| From: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> | |||
| Date: Tue, 2 Feb 2016 10:07:22 +0100 | |||
| Subject: [PATCH] mountd: Add check for 'struct file_handle' | |||
| 
 | |||
| The code to check if name_to_handle_at() is implemented generates only a | |||
| warning but with some toolchain it doesn't fail to link (the function must be | |||
| implemented somewhere). | |||
| However the "struct file_handle" type is not available. | |||
| 
 | |||
| So, this patch adds a check for this struct. | |||
| 
 | |||
| Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> | |||
| ---
 | |||
|  configure.ac         | 1 + | |||
|  utils/mountd/cache.c | 2 +- | |||
|  2 files changed, 2 insertions(+), 1 deletion(-) | |||
| 
 | |||
| diff --git a/configure.ac b/configure.ac
 | |||
| index 25d2ba4..913a86f 100644
 | |||
| --- a/configure.ac
 | |||
| +++ b/configure.ac
 | |||
| @@ -425,6 +425,7 @@ AC_TYPE_PID_T
 | |||
|  AC_TYPE_SIZE_T | |||
|  AC_HEADER_TIME | |||
|  AC_STRUCT_TM | |||
| +AC_CHECK_TYPES([struct file_handle])
 | |||
|   | |||
|  dnl ************************************************************* | |||
|  dnl Check for functions | |||
| diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
 | |||
| index 7847446..dc64f6d 100644
 | |||
| --- a/utils/mountd/cache.c
 | |||
| +++ b/utils/mountd/cache.c
 | |||
| @@ -424,7 +424,7 @@ static int same_path(char *child, char *parent, int len)
 | |||
|  	if (count_slashes(p) != count_slashes(parent)) | |||
|  		return 0; | |||
|   | |||
| -#if HAVE_NAME_TO_HANDLE_AT
 | |||
| +#if defined(HAVE_NAME_TO_HANDLE_AT) && defined(HAVE_STRUCT_FILE_HANDLE)
 | |||
|  	struct { | |||
|  		struct file_handle fh; | |||
|  		unsigned char handle[128]; | |||
| -- 
 | |||
| 2.7.0 | |||
| 
 | |||
					Loading…
					
					
				
		Reference in new issue