Skip to content

Commit 02a57d6

Browse files
committed
[kernel] Increase size of max UNIX socket name to 20
1 parent 89aa884 commit 02a57d6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

elks/include/linuxmt/un.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef __LINUXMT_UN_H
22
#define __LINUXMT_UN_H
33

4-
#define UNIX_PATH_MAX 16 /* keep size of unix_proto_data small, incl/NUL */
4+
#define UNIX_PATH_MAX 20 /* keep size of unix_proto_data small, incl/NUL */
55

66
struct sockaddr_un {
77
unsigned short sun_family; /* AF_UNIX */

elkscmd/screen/screen.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static char DefaultShell[] = "/bin/sh";
134134
static char DefaultPath[] = ":/bin:/usr/bin";
135135
static int TtyMode = 0622;
136136
static char SockPath[PATH_MAX];
137-
static char SockDir[] = "screen";
137+
static char SockDir[] = "scr";
138138
static char *SockNamePtr, *SockName;
139139
static int ServerSocket;
140140
static char *NewEnv[MAXARGS];
@@ -313,7 +313,7 @@ main(int ac, char **av)
313313
if ((home = getenv("HOME")) == 0)
314314
Msg(0, "$HOME is undefined.");
315315

316-
sprintf(SockPath, "%s/%s", home, SockDir); /* SockDir = "screen" */
316+
sprintf(SockPath, "%s/%s", home, SockDir); /* SockDir = "scr" */
317317
if (stat(SockPath, &st) == -1) {
318318
if (errno == ENOENT) {
319319
if (mkdir(SockPath, 0700) == -1)
@@ -1392,14 +1392,14 @@ MakeServerSocket(void)
13921392
a.sun_family = AF_UNIX;
13931393
strcpy(SockNamePtr, SockName);
13941394
strcpy(a.sun_path, SockPath);
1395-
if (connect(s, (struct sockaddr *)&a, strlen(SockPath) + 2) != -1) {
1395+
if (connect(s, (struct sockaddr *)&a, strlen(SockPath) + 1) != -1) {
13961396
p = Filename(SockPath);
13971397
Msg(0, "You have already a screen running on %s.\n\
13981398
If it has been detached, try \"screen -r\".", p);
13991399
/* NOTREACHED */
14001400
}
14011401
unlink(SockPath);
1402-
if (bind(s, (struct sockaddr *)&a, strlen(SockPath) + 2) == -1)
1402+
if (bind(s, (struct sockaddr *)&a, strlen(SockPath) + 1) == -1)
14031403
Msg(errno, "bind");
14041404
chown(SockPath, getuid(), getgid());
14051405
if (listen(s, 5) == -1)
@@ -1418,7 +1418,7 @@ MakeClientSocket(int err)
14181418
a.sun_family = AF_UNIX;
14191419
strcpy(SockNamePtr, SockName);
14201420
strcpy(a.sun_path, SockPath);
1421-
if (connect(s, (struct sockaddr *)&a, strlen(SockPath) + 2) == -1) {
1421+
if (connect(s, (struct sockaddr *)&a, strlen(SockPath) + 1) == -1) {
14221422
if (err) {
14231423
Msg(errno, "connect: %s", SockPath);
14241424
} else {

0 commit comments

Comments
 (0)