summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch295
1 files changed, 295 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch
new file mode 100644
index 0000000000..aa551ebd19
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch
@@ -0,0 +1,295 @@
1From 690a90a5b7786e40b5447ad7c5f19a7657d27405 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <Mingli.Yu@windriver.com>
3Date: Fri, 14 Dec 2018 17:44:32 +0800
4Subject: [PATCH] Makefile.am: fix undefined function for libnsm.a
5
6The source file of libnsm.a uses some function
7in ../support/misc/file.c, add ../support/misc/file.c
8to libnsm_a_SOURCES to fix build error when run
9"make -C tests statdb_dump":
10| ../support/nsm/libnsm.a(file.o): In function `nsm_make_pathname':
11| /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'
12| /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'
13| /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'
14| ../support/nsm/libnsm.a(file.o): In function `nsm_setup_pathnames':
15| /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'
16| collect2: error: ld returned 1 exit status
17
18As there is already one source file named file.c
19as support/nsm/file.c in support/nsm/Makefile.am,
20so rename ../support/misc/file.c to ../support/misc/misc.c.
21
22Upstream-Status: Submitted[https://marc.info/?l=linux-nfs&m=154502780423058&w=2]
23
24Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
25---
26 support/misc/Makefile.am | 2 +-
27 support/misc/file.c | 111 -----------------------------------------------
28 support/misc/misc.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++
29 support/nsm/Makefile.am | 2 +-
30 4 files changed, 113 insertions(+), 113 deletions(-)
31 delete mode 100644 support/misc/file.c
32 create mode 100644 support/misc/misc.c
33
34diff --git a/support/misc/Makefile.am b/support/misc/Makefile.am
35index 8936b0d..d4c1f76 100644
36--- a/support/misc/Makefile.am
37+++ b/support/misc/Makefile.am
38@@ -1,6 +1,6 @@
39 ## Process this file with automake to produce Makefile.in
40
41 noinst_LIBRARIES = libmisc.a
42-libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c file.c
43+libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c misc.c
44
45 MAINTAINERCLEANFILES = Makefile.in
46diff --git a/support/misc/file.c b/support/misc/file.c
47deleted file mode 100644
48index e7c3819..0000000
49--- a/support/misc/file.c
50+++ /dev/null
51@@ -1,111 +0,0 @@
52-/*
53- * Copyright 2009 Oracle. All rights reserved.
54- * Copyright 2017 Red Hat, Inc. All rights reserved.
55- *
56- * This file is part of nfs-utils.
57- *
58- * nfs-utils is free software; you can redistribute it and/or modify
59- * it under the terms of the GNU General Public License as published by
60- * the Free Software Foundation; either version 2 of the License, or
61- * (at your option) any later version.
62- *
63- * nfs-utils is distributed in the hope that it will be useful,
64- * but WITHOUT ANY WARRANTY; without even the implied warranty of
65- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
66- * GNU General Public License for more details.
67- *
68- * You should have received a copy of the GNU General Public License
69- * along with nfs-utils. If not, see <http://www.gnu.org/licenses/>.
70- */
71-
72-#include <sys/stat.h>
73-
74-#include <string.h>
75-#include <libgen.h>
76-#include <stdio.h>
77-#include <errno.h>
78-#include <dirent.h>
79-#include <stdlib.h>
80-#include <stdbool.h>
81-#include <limits.h>
82-
83-#include "xlog.h"
84-#include "misc.h"
85-
86-/*
87- * Returns a dynamically allocated, '\0'-terminated buffer
88- * containing an appropriate pathname, or NULL if an error
89- * occurs. Caller must free the returned result with free(3).
90- */
91-__attribute__((__malloc__))
92-char *
93-generic_make_pathname(const char *base, const char *leaf)
94-{
95- size_t size;
96- char *path;
97- int len;
98-
99- size = strlen(base) + strlen(leaf) + 2;
100- if (size > PATH_MAX)
101- return NULL;
102-
103- path = malloc(size);
104- if (path == NULL)
105- return NULL;
106-
107- len = snprintf(path, size, "%s/%s", base, leaf);
108- if ((len < 0) || ((size_t)len >= size)) {
109- free(path);
110- return NULL;
111- }
112-
113- return path;
114-}
115-
116-
117-/**
118- * generic_setup_basedir - set up basedir
119- * @progname: C string containing name of program, for error messages
120- * @parentdir: C string containing pathname to on-disk state, or NULL
121- * @base: character buffer to contain the basedir that is set up
122- * @baselen: size of @base in bytes
123- *
124- * This runs before logging is set up, so error messages are directed
125- * to stderr.
126- *
127- * Returns true and sets up our basedir, if @parentdir was valid
128- * and usable; otherwise false is returned.
129- */
130-_Bool
131-generic_setup_basedir(const char *progname, const char *parentdir, char *base,
132- const size_t baselen)
133-{
134- static char buf[PATH_MAX];
135- struct stat st;
136- char *path;
137-
138- /* First: test length of name and whether it exists */
139- if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
140- (void)fprintf(stderr, "%s: Directory name too long: %s",
141- progname, parentdir);
142- return false;
143- }
144- if (lstat(parentdir, &st) == -1) {
145- (void)fprintf(stderr, "%s: Failed to stat %s: %s",
146- progname, parentdir, strerror(errno));
147- return false;
148- }
149-
150- /* Ensure we have a clean directory pathname */
151- strncpy(buf, parentdir, sizeof(buf)-1);
152- path = dirname(buf);
153- if (*path == '.') {
154- (void)fprintf(stderr, "%s: Unusable directory %s",
155- progname, parentdir);
156- return false;
157- }
158-
159- xlog(D_CALL, "Using %s as the state directory", parentdir);
160- strcpy(base, parentdir);
161- return true;
162-}
163diff --git a/support/misc/misc.c b/support/misc/misc.c
164new file mode 100644
165index 0000000..e7c3819
166--- /dev/null
167+++ b/support/misc/misc.c
168@@ -0,0 +1,111 @@
169+/*
170+ * Copyright 2009 Oracle. All rights reserved.
171+ * Copyright 2017 Red Hat, Inc. All rights reserved.
172+ *
173+ * This file is part of nfs-utils.
174+ *
175+ * nfs-utils is free software; you can redistribute it and/or modify
176+ * it under the terms of the GNU General Public License as published by
177+ * the Free Software Foundation; either version 2 of the License, or
178+ * (at your option) any later version.
179+ *
180+ * nfs-utils is distributed in the hope that it will be useful,
181+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
182+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+ * GNU General Public License for more details.
184+ *
185+ * You should have received a copy of the GNU General Public License
186+ * along with nfs-utils. If not, see <http://www.gnu.org/licenses/>.
187+ */
188+
189+#include <sys/stat.h>
190+
191+#include <string.h>
192+#include <libgen.h>
193+#include <stdio.h>
194+#include <errno.h>
195+#include <dirent.h>
196+#include <stdlib.h>
197+#include <stdbool.h>
198+#include <limits.h>
199+
200+#include "xlog.h"
201+#include "misc.h"
202+
203+/*
204+ * Returns a dynamically allocated, '\0'-terminated buffer
205+ * containing an appropriate pathname, or NULL if an error
206+ * occurs. Caller must free the returned result with free(3).
207+ */
208+__attribute__((__malloc__))
209+char *
210+generic_make_pathname(const char *base, const char *leaf)
211+{
212+ size_t size;
213+ char *path;
214+ int len;
215+
216+ size = strlen(base) + strlen(leaf) + 2;
217+ if (size > PATH_MAX)
218+ return NULL;
219+
220+ path = malloc(size);
221+ if (path == NULL)
222+ return NULL;
223+
224+ len = snprintf(path, size, "%s/%s", base, leaf);
225+ if ((len < 0) || ((size_t)len >= size)) {
226+ free(path);
227+ return NULL;
228+ }
229+
230+ return path;
231+}
232+
233+
234+/**
235+ * generic_setup_basedir - set up basedir
236+ * @progname: C string containing name of program, for error messages
237+ * @parentdir: C string containing pathname to on-disk state, or NULL
238+ * @base: character buffer to contain the basedir that is set up
239+ * @baselen: size of @base in bytes
240+ *
241+ * This runs before logging is set up, so error messages are directed
242+ * to stderr.
243+ *
244+ * Returns true and sets up our basedir, if @parentdir was valid
245+ * and usable; otherwise false is returned.
246+ */
247+_Bool
248+generic_setup_basedir(const char *progname, const char *parentdir, char *base,
249+ const size_t baselen)
250+{
251+ static char buf[PATH_MAX];
252+ struct stat st;
253+ char *path;
254+
255+ /* First: test length of name and whether it exists */
256+ if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
257+ (void)fprintf(stderr, "%s: Directory name too long: %s",
258+ progname, parentdir);
259+ return false;
260+ }
261+ if (lstat(parentdir, &st) == -1) {
262+ (void)fprintf(stderr, "%s: Failed to stat %s: %s",
263+ progname, parentdir, strerror(errno));
264+ return false;
265+ }
266+
267+ /* Ensure we have a clean directory pathname */
268+ strncpy(buf, parentdir, sizeof(buf)-1);
269+ path = dirname(buf);
270+ if (*path == '.') {
271+ (void)fprintf(stderr, "%s: Unusable directory %s",
272+ progname, parentdir);
273+ return false;
274+ }
275+
276+ xlog(D_CALL, "Using %s as the state directory", parentdir);
277+ strcpy(base, parentdir);
278+ return true;
279+}
280diff --git a/support/nsm/Makefile.am b/support/nsm/Makefile.am
281index 8f5874e..68f1a46 100644
282--- a/support/nsm/Makefile.am
283+++ b/support/nsm/Makefile.am
284@@ -10,7 +10,7 @@ GENFILES = $(GENFILES_CLNT) $(GENFILES_SVC) $(GENFILES_XDR) $(GENFILES_H)
285 EXTRA_DIST = sm_inter.x
286
287 noinst_LIBRARIES = libnsm.a
288-libnsm_a_SOURCES = $(GENFILES) file.c rpc.c
289+libnsm_a_SOURCES = $(GENFILES) ../misc/misc.c file.c rpc.c
290
291 BUILT_SOURCES = $(GENFILES)
292
293--
2942.7.4
295