diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2015-09-15 22:41:29 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2015-09-15 22:41:29 +0300 |
commit | 21f9b84b4b729fbd7acbd465e7a3f726e4d20f91 (patch) | |
tree | eb2d091d427ca0813b445509d59cc8e27e8ad25f /yocto-poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch | |
parent | 101cef31e2bf54c678501155cd2106251acbd076 (diff) | |
parent | c124f4f2e04dca16a428a76c89677328bc7bf908 (diff) | |
download | openbmc-21f9b84b4b729fbd7acbd465e7a3f726e4d20f91.tar.xz |
Merge commit 'c124f4f2e04dca16a428a76c89677328bc7bf908' as 'yocto-poky'
Diffstat (limited to 'yocto-poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch')
-rw-r--r-- | yocto-poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/yocto-poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch b/yocto-poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch new file mode 100644 index 000000000..219dd35ae --- /dev/null +++ b/yocto-poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch @@ -0,0 +1,74 @@ +nfs.c: Allow max sa.sun_path for a localdomain socket with the user nfs-server + +There is a hard limit for the kernel of 108 characters for a +localdomain socket name. To avoid problems with the user nfs +server it should maximize the number of characters by using +a relative path on the server side. + +Previously the nfs-server used the absolute path name passed to +the sa.sunpath arg for binding the socket and this has caused +problems for both the X server and UST binaries which make +heavy use of named sockets with long names. + +Signed-off-by: Jason Wessel <jason.wessel@windriver.com> + +Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ + +--- + nfs.c | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +--- a/nfs.c ++++ b/nfs.c +@@ -672,6 +672,7 @@ SYMLINK3res *nfsproc3_symlink_3_svc(SYML + } + + #ifndef WIN32 ++static char pathbuf_tmp[NFS_MAXPATHLEN + NFS_MAXNAMLEN + 1]; + + /* + * create Unix socket +@@ -680,17 +681,41 @@ static int mksocket(const char *path, mo + { + int res, sock; + struct sockaddr_un addr; ++ unsigned int len = strlen(path); + + sock = socket(PF_UNIX, SOCK_STREAM, 0); +- addr.sun_family = AF_UNIX; +- strcpy(addr.sun_path, path); + res = sock; + if (res != -1) { ++ addr.sun_family = AF_UNIX; ++ if (len < sizeof(addr.sun_path) -1) { ++ strcpy(addr.sun_path, path); ++ } else { ++ char *ptr; ++ res = -1; ++ if (len >= sizeof(path)) ++ goto out; ++ strcpy(pathbuf_tmp, path); ++ ptr = strrchr(pathbuf_tmp,'/'); ++ if (ptr) { ++ *ptr = '\0'; ++ ptr++; ++ if (chdir(pathbuf_tmp)) ++ goto out; ++ } else { ++ ptr = pathbuf_tmp; ++ } ++ if (strlen(ptr) >= sizeof(addr.sun_path)) ++ goto out; ++ strcpy(addr.sun_path, ptr); ++ } + umask(~mode); + res = + bind(sock, (struct sockaddr *) &addr, + sizeof(addr.sun_family) + strlen(addr.sun_path)); + umask(0); ++out: ++ if (chdir("/")) ++ fprintf(stderr, "Internal failure to chdir /\n"); + close(sock); + } + return res; |