summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Dinu <andrei.adrianx.dinu@intel.com>2013-05-15 12:32:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-21 00:18:45 +0100
commitb86fdc09c87e4353ef163d82a4a0b38583fdcc91 (patch)
treeed8b061ed24fc7193a78a61937150921a8a680a9
parent503c669ca7af397cba0286908f2db2b5d533c0c3 (diff)
downloadpoky-b86fdc09c87e4353ef163d82a4a0b38583fdcc91.tar.gz
nfs-utils : upgrade to 1.2.8
upgrade from 1.2.7 -> 1.2.8 Removed patches that are already in the upstream. Added a make clean routine needed because the package comes with precompiled 64-bit objects that break the build. (From OE-Core rev: f505e913eae5e91d494234ee38a38ac961583b12) Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch26
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch599
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb (renamed from meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.7.bb)12
3 files changed, 8 insertions, 629 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch
deleted file mode 100644
index 465144a322..0000000000
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1[PATCH] fix build with uClibc
2
3uClibc doesn't have/need libio.h, so don't include it from sockaddr.h
4
5Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
6---
7 support/include/sockaddr.h | 5 ++++-
8 1 file changed, 4 insertions(+), 1 deletion(-)
9
10Upstream-Status: Pending
11
12Index: nfs-utils-1.2.3/support/include/sockaddr.h
13===================================================================
14--- nfs-utils-1.2.3.orig/support/include/sockaddr.h
15+++ nfs-utils-1.2.3/support/include/sockaddr.h
16@@ -20,7 +20,10 @@
17 #ifndef NFS_UTILS_SOCKADDR_H
18 #define NFS_UTILS_SOCKADDR_H
19
20+/* uClibc doesn't have/need libio.h */
21+#ifndef __UCLIBC__
22 #include <libio.h>
23+#endif
24 #include <stdbool.h>
25 #include <sys/socket.h>
26 #include <netinet/in.h>
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch
deleted file mode 100644
index 0411b47982..0000000000
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.1.2.8.rc3.patch
+++ /dev/null
@@ -1,599 +0,0 @@
1Backported from Fedora
2
3This is a cumulative fixes patch between 1.2.7 and 1.2.8 latest rc
4
5Upstream-Status: Backport
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8diff --git a/support/export/rmtab.c b/support/export/rmtab.c
9index 31c0f50..d16b3b3 100644
10--- a/support/export/rmtab.c
11+++ b/support/export/rmtab.c
12@@ -1,7 +1,7 @@
13 /*
14- * support/export/rmntab.c
15+ * support/export/rmtab.c
16 *
17- * Interface to the rmnt file.
18+ * Interface to the rmtab file.
19 *
20 */
21
22@@ -12,7 +12,7 @@
23 #include <stdlib.h>
24 #include <string.h>
25 #include <errno.h>
26-#include "xmalloc.h"
27+
28 #include "misc.h"
29 #include "nfslib.h"
30 #include "exportfs.h"
31diff --git a/support/export/xtab.c b/support/export/xtab.c
32index 2a43193..e953071 100644
33--- a/support/export/xtab.c
34+++ b/support/export/xtab.c
35@@ -14,7 +14,7 @@
36 #include <unistd.h>
37 #include <stdlib.h>
38 #include <string.h>
39-#include "xmalloc.h"
40+
41 #include "nfslib.h"
42 #include "exportfs.h"
43 #include "xio.h"
44diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
45index e641c45..61e07a8 100644
46--- a/support/nfs/cacheio.c
47+++ b/support/nfs/cacheio.c
48@@ -162,11 +162,16 @@ int qword_eol(FILE *f)
49 {
50 int err;
51
52- fprintf(f,"\n");
53- err = fflush(f);
54- if (err) {
55- xlog_warn("qword_eol: fflush failed: errno %d (%s)",
56+ err = fprintf(f,"\n");
57+ if (err < 0) {
58+ xlog_warn("qword_eol: fprintf failed: errno %d (%s)",
59 errno, strerror(errno));
60+ } else {
61+ err = fflush(f);
62+ if (err) {
63+ xlog_warn("qword_eol: fflush failed: errno %d (%s)",
64+ errno, strerror(errno));
65+ }
66 }
67 /*
68 * We must send one line (and one line only) in a single write
69diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
70index ec251fa..d01ba2f 100644
71--- a/utils/gssd/gssd_proc.c
72+++ b/utils/gssd/gssd_proc.c
73@@ -52,6 +52,7 @@
74 #include <sys/socket.h>
75 #include <arpa/inet.h>
76 #include <sys/fsuid.h>
77+#include <sys/resource.h>
78
79 #include <stdio.h>
80 #include <stdlib.h>
81@@ -250,21 +251,10 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
82 if ((p = strstr(buf, "port")) != NULL)
83 sscanf(p, "port: %127s\n", port);
84
85- /* check service, program, and version */
86- if (memcmp(service, "nfs", 3) != 0)
87- return -1;
88+ /* get program, and version numbers */
89 *prog = atoi(program + 1); /* skip open paren */
90 *vers = atoi(version);
91
92- if (strlen(service) == 3 ) {
93- if ((*prog != 100003) || ((*vers != 2) && (*vers != 3) &&
94- (*vers != 4)))
95- goto fail;
96- } else if (memcmp(service, "nfs4_cb", 7) == 0) {
97- if (*vers != 1)
98- goto fail;
99- }
100-
101 if (!addrstr_to_sockaddr(addr, address, port))
102 goto fail;
103
104@@ -398,10 +388,10 @@ process_clnt_dir_files(struct clnt_info * clp)
105 static int
106 get_poll_index(int *ind)
107 {
108- int i;
109+ unsigned int i;
110
111 *ind = -1;
112- for (i=0; i<FD_ALLOC_BLOCK; i++) {
113+ for (i=0; i<pollsize; i++) {
114 if (pollarray[i].events == 0) {
115 *ind = i;
116 break;
117@@ -483,9 +473,13 @@ fail_keep_client:
118 void
119 init_client_list(void)
120 {
121+ struct rlimit rlim;
122 TAILQ_INIT(&clnt_list);
123 /* Eventually plan to grow/shrink poll array: */
124 pollsize = FD_ALLOC_BLOCK;
125+ if (getrlimit(RLIMIT_NOFILE, &rlim) < 0 &&
126+ rlim.rlim_cur != RLIM_INFINITY)
127+ pollsize = rlim.rlim_cur;
128 pollarray = calloc(pollsize, sizeof(struct pollfd));
129 }
130
131@@ -567,9 +561,8 @@ process_pipedir(char *pipe_name)
132
133 update_old_clients(namelist, j, pipe_name);
134 for (i=0; i < j; i++) {
135- if (i < FD_ALLOC_BLOCK
136- && !strncmp(namelist[i]->d_name, "clnt", 4)
137- && !find_client(namelist[i]->d_name, pipe_name))
138+ if (!strncmp(namelist[i]->d_name, "clnt", 4)
139+ && !find_client(namelist[i]->d_name, pipe_name))
140 process_clnt_dir(namelist[i]->d_name, pipe_name);
141 free(namelist[i]);
142 }
143@@ -962,12 +955,6 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname,
144
145 printerr(1, "handling krb5 upcall (%s)\n", clp->dirname);
146
147- if (tgtname) {
148- if (clp->servicename) {
149- free(clp->servicename);
150- clp->servicename = strdup(tgtname);
151- }
152- }
153 token.length = 0;
154 token.value = NULL;
155 memset(&pd, 0, sizeof(struct authgss_private_data));
156@@ -1016,7 +1003,8 @@ process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname,
157 int success = 0;
158 do {
159 gssd_refresh_krb5_machine_credential(clp->servername,
160- NULL, service);
161+ NULL, service,
162+ tgtname);
163 /*
164 * Get a list of credential cache names and try each
165 * of them until one works or we've tried them all
166diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
167index 60ba594..aeb8f70 100644
168--- a/utils/gssd/krb5_util.c
169+++ b/utils/gssd/krb5_util.c
170@@ -774,12 +774,16 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
171 }
172
173 /*
174- * Find a keytab entry to use for a given target hostname.
175+ * Find a keytab entry to use for a given target realm.
176 * Tries to find the most appropriate keytab to use given the
177 * name of the host we are trying to connect with.
178+ *
179+ * Note: the tgtname contains a hostname in the realm that we
180+ * are authenticating to. It may, or may not be the same as
181+ * the server hostname.
182 */
183 static int
184-find_keytab_entry(krb5_context context, krb5_keytab kt, const char *hostname,
185+find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
186 krb5_keytab_entry *kte, const char **svcnames)
187 {
188 krb5_error_code code;
189@@ -795,7 +799,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *hostname,
190
191
192 /* Get full target hostname */
193- retval = get_full_hostname(hostname, targethostname,
194+ retval = get_full_hostname(tgtname, targethostname,
195 sizeof(targethostname));
196 if (retval)
197 goto out;
198@@ -1128,7 +1132,7 @@ gssd_get_krb5_machine_cred_list(char ***list)
199 if (ple->ccname) {
200 /* Make sure cred is up-to-date before returning it */
201 retval = gssd_refresh_krb5_machine_credential(NULL, ple,
202- NULL);
203+ NULL, NULL);
204 if (retval)
205 continue;
206 if (i + 1 > listsize) {
207@@ -1219,7 +1223,8 @@ gssd_destroy_krb5_machine_creds(void)
208 int
209 gssd_refresh_krb5_machine_credential(char *hostname,
210 struct gssd_k5_kt_princ *ple,
211- char *service)
212+ char *service,
213+ char *tgtname)
214 {
215 krb5_error_code code = 0;
216 krb5_context context;
217@@ -1258,7 +1263,10 @@ gssd_refresh_krb5_machine_credential(char *hostname,
218 if (ple == NULL) {
219 krb5_keytab_entry kte;
220
221- code = find_keytab_entry(context, kt, hostname, &kte, svcnames);
222+ if (tgtname == NULL)
223+ tgtname = hostname;
224+
225+ code = find_keytab_entry(context, kt, tgtname, &kte, svcnames);
226 if (code) {
227 printerr(0, "ERROR: %s: no usable keytab entry found "
228 "in keytab %s for connection with host %s\n",
229diff --git a/utils/gssd/krb5_util.h b/utils/gssd/krb5_util.h
230index cd6e107..9f41625 100644
231--- a/utils/gssd/krb5_util.h
232+++ b/utils/gssd/krb5_util.h
233@@ -31,7 +31,8 @@ void gssd_setup_krb5_machine_gss_ccache(char *servername);
234 void gssd_destroy_krb5_machine_creds(void);
235 int gssd_refresh_krb5_machine_credential(char *hostname,
236 struct gssd_k5_kt_princ *ple,
237- char *service);
238+ char *service,
239+ char *tgtname);
240 char *gssd_k5_err_msg(krb5_context context, krb5_error_code code);
241 void gssd_k5_get_default_realm(char **def_realm);
242
243diff --git a/utils/gssd/svcgssd_krb5.c b/utils/gssd/svcgssd_krb5.c
244index 6c34faf..1d44d34 100644
245--- a/utils/gssd/svcgssd_krb5.c
246+++ b/utils/gssd/svcgssd_krb5.c
247@@ -38,6 +38,7 @@
248
249 #include <stdio.h>
250 #include <errno.h>
251+#include <ctype.h>
252 #include <gssapi/gssapi.h>
253 #include <krb5.h>
254
255@@ -98,6 +99,12 @@ parse_enctypes(char *enctypes)
256 if (n == 0)
257 return ENOENT;
258
259+ /* Skip pass any non digits */
260+ while (*enctypes && isdigit(*enctypes) == 0)
261+ enctypes++;
262+ if (*enctypes == '\0')
263+ return EINVAL;
264+
265 /* Allocate space for enctypes array */
266 if ((parsed_enctypes = (int *) calloc(n, sizeof(int))) == NULL) {
267 return ENOMEM;
268diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
269index e80efb4..beba9c4 100644
270--- a/utils/idmapd/idmapd.c
271+++ b/utils/idmapd/idmapd.c
272@@ -145,7 +145,6 @@ static void svrreopen(int, short, void *);
273 static int nfsopen(struct idmap_client *);
274 static void nfscb(int, short, void *);
275 static void nfsdcb(int, short, void *);
276-static int validateascii(char *, u_int32_t);
277 static int addfield(char **, ssize_t *, char *);
278 static int getfield(char **, char *, size_t);
279
280@@ -425,7 +424,8 @@ dirscancb(int UNUSED(fd), short UNUSED(which), void *data)
281 pipefsdir, ents[i]->d_name);
282
283 if ((ic->ic_dirfd = open(path, O_RDONLY, 0)) == -1) {
284- xlog_warn("dirscancb: open(%s): %s", path, strerror(errno));
285+ if (verbose > 0)
286+ xlog_warn("dirscancb: open(%s): %s", path, strerror(errno));
287 free(ic);
288 goto out;
289 }
290@@ -642,6 +642,8 @@ out:
291 static void
292 imconv(struct idmap_client *ic, struct idmap_msg *im)
293 {
294+ u_int32_t len;
295+
296 switch (im->im_conv) {
297 case IDMAP_CONV_IDTONAME:
298 idtonameres(im);
299@@ -652,10 +654,10 @@ imconv(struct idmap_client *ic, struct idmap_msg *im)
300 im->im_id, im->im_name);
301 break;
302 case IDMAP_CONV_NAMETOID:
303- if (validateascii(im->im_name, sizeof(im->im_name)) == -1) {
304- im->im_status |= IDMAP_STATUS_INVALIDMSG;
305+ len = strnlen(im->im_name, IDMAP_NAMESZ - 1);
306+ /* Check for NULL termination just to be careful */
307+ if (im->im_name[len+1] != '\0')
308 return;
309- }
310 nametoidres(im);
311 if (verbose > 1)
312 xlog_warn("%s %s: (%s) name \"%s\" -> id \"%d\"",
313@@ -855,25 +857,6 @@ nametoidres(struct idmap_msg *im)
314 }
315
316 static int
317-validateascii(char *string, u_int32_t len)
318-{
319- u_int32_t i;
320-
321- for (i = 0; i < len; i++) {
322- if (string[i] == '\0')
323- break;
324-
325- if (string[i] & 0x80)
326- return (-1);
327- }
328-
329- if ((i >= len) || string[i] != '\0')
330- return (-1);
331-
332- return (i + 1);
333-}
334-
335-static int
336 addfield(char **bpp, ssize_t *bsizp, char *fld)
337 {
338 char ch, *bp = *bpp;
339diff --git a/utils/mount/error.c b/utils/mount/error.c
340index 83ad1d2..f8fc13f 100644
341--- a/utils/mount/error.c
342+++ b/utils/mount/error.c
343@@ -225,7 +225,7 @@ void mount_error(const char *spec, const char *mount_point, int error)
344 case ENOENT:
345 if (spec)
346 nfs_error(_("%s: mounting %s failed, "
347- "reason given by server:\n %s"),
348+ "reason given by server: %s"),
349 progname, spec, strerror(error));
350 else
351 nfs_error(_("%s: mount point %s does not exist"),
352diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
353index 9b4197b..8ee3024 100644
354--- a/utils/mount/stropts.c
355+++ b/utils/mount/stropts.c
356@@ -666,6 +666,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
357 case EOPNOTSUPP:
358 case EHOSTUNREACH:
359 case ETIMEDOUT:
360+ case EACCES:
361 continue;
362 default:
363 goto out;
364@@ -761,6 +762,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
365 case ECONNREFUSED:
366 case EHOSTUNREACH:
367 case ETIMEDOUT:
368+ case EACCES:
369 continue;
370 default:
371 goto out;
372diff --git a/utils/mountd/auth.c b/utils/mountd/auth.c
373index 508040a..330cab5 100644
374--- a/utils/mountd/auth.c
375+++ b/utils/mountd/auth.c
376@@ -10,10 +10,12 @@
377 #include <config.h>
378 #endif
379
380+#include <sys/types.h>
381 #include <sys/stat.h>
382 #include <netinet/in.h>
383 #include <arpa/inet.h>
384 #include <errno.h>
385+#include <fcntl.h>
386 #include <unistd.h>
387
388 #include "sockaddr.h"
389@@ -21,7 +23,6 @@
390 #include "nfslib.h"
391 #include "exportfs.h"
392 #include "mountd.h"
393-#include "xmalloc.h"
394 #include "v4root.h"
395
396 enum auth_error
397diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
398index e950ec6..45012be 100644
399--- a/utils/mountd/cache.c
400+++ b/utils/mountd/cache.c
401@@ -29,7 +29,6 @@
402 #include "nfslib.h"
403 #include "exportfs.h"
404 #include "mountd.h"
405-#include "xmalloc.h"
406 #include "fsloc.h"
407 #include "pseudoflavors.h"
408
409@@ -109,12 +108,10 @@ static void auth_unix_ip(FILE *f)
410 struct addrinfo *ai = NULL;
411
412 ai = client_resolve(tmp->ai_addr);
413- if (ai == NULL)
414- goto out;
415- client = client_compose(ai);
416- freeaddrinfo(ai);
417- if (!client)
418- goto out;
419+ if (ai) {
420+ client = client_compose(ai);
421+ freeaddrinfo(ai);
422+ }
423 }
424 qword_print(f, "nfsd");
425 qword_print(f, ipaddr);
426@@ -127,7 +124,6 @@ static void auth_unix_ip(FILE *f)
427 xlog(D_CALL, "auth_unix_ip: client %p '%s'", client, client?client: "DEFAULT");
428
429 free(client);
430-out:
431 freeaddrinfo(tmp);
432
433 }
434@@ -347,6 +343,30 @@ static char *next_mnt(void **v, char *p)
435 return me->mnt_dir;
436 }
437
438+static int is_subdirectory(char *child, char *parent)
439+{
440+ size_t l = strlen(parent);
441+
442+ if (strcmp(parent, "/") == 0)
443+ return 1;
444+
445+ return strcmp(child, parent) == 0
446+ || (strncmp(child, parent, l) == 0 && child[l] == '/');
447+}
448+
449+static int path_matches(nfs_export *exp, char *path)
450+{
451+ if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT)
452+ return is_subdirectory(path, exp->m_export.e_path);
453+ return strcmp(path, exp->m_export.e_path) == 0;
454+}
455+
456+static int
457+export_matches(nfs_export *exp, char *dom, char *path, struct addrinfo *ai)
458+{
459+ return path_matches(exp, path) && client_matches(exp, dom, ai);
460+}
461+
462 /* True iff e1 is a child of e2 and e2 has crossmnt set: */
463 static bool subexport(struct exportent *e1, struct exportent *e2)
464 {
465@@ -354,8 +374,7 @@ static bool subexport(struct exportent *e1, struct exportent *e2)
466 size_t l2 = strlen(p2);
467
468 return e2->e_flags & NFSEXP_CROSSMOUNT
469- && strncmp(p1, p2, l2) == 0
470- && p1[l2] == '/';
471+ && is_subdirectory(p1, p2);
472 }
473
474 struct parsed_fsid {
475@@ -756,27 +775,6 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex
476 return qword_eol(f);
477 }
478
479-static int is_subdirectory(char *child, char *parent)
480-{
481- size_t l = strlen(parent);
482-
483- return strcmp(child, parent) == 0
484- || (strncmp(child, parent, l) == 0 && child[l] == '/');
485-}
486-
487-static int path_matches(nfs_export *exp, char *path)
488-{
489- if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT)
490- return is_subdirectory(path, exp->m_export.e_path);
491- return strcmp(path, exp->m_export.e_path) == 0;
492-}
493-
494-static int
495-export_matches(nfs_export *exp, char *dom, char *path, struct addrinfo *ai)
496-{
497- return path_matches(exp, path) && client_matches(exp, dom, ai);
498-}
499-
500 static nfs_export *
501 lookup_export(char *dom, char *path, struct addrinfo *ai)
502 {
503@@ -830,6 +828,7 @@ lookup_export(char *dom, char *path, struct addrinfo *ai)
504
505 #ifdef HAVE_NFS_PLUGIN_H
506 #include <dlfcn.h>
507+#include <link.h>
508 #include <nfs-plugin.h>
509
510 /*
511@@ -1094,6 +1093,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
512 struct addrinfo *ai)
513 {
514 struct exportent *exp;
515+ struct link_map *map;
516 void *handle;
517
518 handle = dlopen("libnfsjunct.so", RTLD_NOW);
519@@ -1101,6 +1101,11 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
520 xlog(D_GENERAL, "%s: dlopen: %s", __func__, dlerror());
521 return NULL;
522 }
523+
524+ if (dlinfo(handle, RTLD_DI_LINKMAP, &map) == 0)
525+ xlog(D_GENERAL, "%s: loaded plug-in %s",
526+ __func__, map->l_name);
527+
528 (void)dlerror(); /* Clear any error */
529
530 exp = invoke_junction_ops(handle, dom, pathname, ai);
531diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
532index 9801b9c..4334340 100644
533--- a/utils/nfsdcltrack/nfsdcltrack.c
534+++ b/utils/nfsdcltrack/nfsdcltrack.c
535@@ -379,6 +379,17 @@ cltrack_legacy_gracedone(void)
536 while ((entry = readdir(v4recovery))) {
537 int len;
538
539+ /* skip "." and ".." */
540+ if (entry->d_name[0] == '.') {
541+ switch (entry->d_name[1]) {
542+ case '\0':
543+ continue;
544+ case '.':
545+ if (entry->d_name[2] == '\0')
546+ continue;
547+ }
548+ }
549+
550 /* borrow the clientid blob for this */
551 len = snprintf((char *)blob, sizeof(blob), "%s/%s", dirname,
552 entry->d_name);
553diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c
554index 4ecb03c..fd576d9 100644
555--- a/utils/statd/rmtcall.c
556+++ b/utils/statd/rmtcall.c
557@@ -68,21 +68,19 @@ statd_get_socket(void)
558 {
559 struct sockaddr_in sin;
560 struct servent *se;
561- int loopcnt = 100;
562+ const int loopcnt = 100;
563+ int i, tmp_sockets[loopcnt];
564
565 if (sockfd >= 0)
566 return sockfd;
567
568- while (loopcnt-- > 0) {
569-
570- if (sockfd >= 0) close(sockfd);
571+ for (i = 0; i < loopcnt; ++i) {
572
573 if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
574 xlog(L_ERROR, "%s: Can't create socket: %m", __func__);
575- return -1;
576+ break;
577 }
578
579-
580 memset(&sin, 0, sizeof(sin));
581 sin.sin_family = AF_INET;
582 sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
583@@ -96,7 +94,16 @@ statd_get_socket(void)
584 if (se == NULL)
585 break;
586 /* rather not use that port, try again */
587+
588+ tmp_sockets[i] = sockfd;
589 }
590+
591+ while (--i >= 0)
592+ close(tmp_sockets[i]);
593+
594+ if (sockfd < 0)
595+ return -1;
596+
597 FD_SET(sockfd, &SVC_FDSET);
598 return sockfd;
599 }
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.7.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb
index cd97810e10..2f3509410a 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.7.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb
@@ -13,14 +13,12 @@ RDEPENDS_${PN} = "rpcbind"
13RRECOMMENDS_${PN} = "kernel-module-nfsd" 13RRECOMMENDS_${PN} = "kernel-module-nfsd"
14 14
15SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.bz2 \ 15SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.bz2 \
16 file://nfs-utils.1.2.8.rc3.patch \
17 file://nfs-utils-1.0.6-uclibc.patch \ 16 file://nfs-utils-1.0.6-uclibc.patch \
18 file://nfs-utils-1.2.3-uclibc-libio.h.patch \
19 file://nfs-utils-1.2.3-sm-notify-res_init.patch \ 17 file://nfs-utils-1.2.3-sm-notify-res_init.patch \
20 file://nfsserver" 18 file://nfsserver"
21 19
22SRC_URI[md5sum] = "3b5ca797197765dc0c3a4122720c7716" 20SRC_URI[md5sum] = "6e7d97de51e428a0b8698c16ca23db77"
23SRC_URI[sha256sum] = "7ef8e0a8b22cd7ff33f3afd28e770d45643fae303468a180640c2967833fe75e" 21SRC_URI[sha256sum] = "1cc8f02a633eddbf0a1d93421f331479c4cdab4c5ab33b8bf8c7c369f9156ac6"
24 22
25PARALLEL_MAKE = "" 23PARALLEL_MAKE = ""
26 24
@@ -54,6 +52,12 @@ FILES_${PN}-client = "${base_sbindir}/*mount.nfs*"
54FILES_${PN}-stats = "${sbindir}/mountstats ${sbindir}/nfsiostat" 52FILES_${PN}-stats = "${sbindir}/mountstats ${sbindir}/nfsiostat"
55RDEPENDS_${PN}-stats = "python" 53RDEPENDS_${PN}-stats = "python"
56 54
55# Make clean needed because the package comes with
56# precompiled 64-bit objects that break the build
57do_compile_prepend() {
58 make clean
59}
60
57do_install_append () { 61do_install_append () {
58 install -d ${D}${sysconfdir}/init.d 62 install -d ${D}${sysconfdir}/init.d
59 install -d ${D}${localstatedir}/lib/nfs/statd 63 install -d ${D}${localstatedir}/lib/nfs/statd