Mercurial > hg
comparison contrib/chg/chg.c @ 30677:c80c16a8a0b0
chg: support long socket path
This patch replaces UNIX_PATH_MAX (108) with PATH_MAX (4096) so we can have
long unix path.
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 23 Dec 2016 16:26:40 +0000 |
parents | b83bddfc8048 |
children | 4677df6b449a |
comparison
equal
deleted
inserted
replaced
30676:b83bddfc8048 | 30677:c80c16a8a0b0 |
---|---|
23 #include <unistd.h> | 23 #include <unistd.h> |
24 | 24 |
25 #include "hgclient.h" | 25 #include "hgclient.h" |
26 #include "util.h" | 26 #include "util.h" |
27 | 27 |
28 #ifndef UNIX_PATH_MAX | 28 #ifndef PATH_MAX |
29 #define UNIX_PATH_MAX (sizeof(((struct sockaddr_un *)NULL)->sun_path)) | 29 #define PATH_MAX 4096 |
30 #endif | 30 #endif |
31 | 31 |
32 struct cmdserveropts { | 32 struct cmdserveropts { |
33 char sockname[UNIX_PATH_MAX]; | 33 char sockname[PATH_MAX]; |
34 char initsockname[UNIX_PATH_MAX]; | 34 char initsockname[PATH_MAX]; |
35 char redirectsockname[UNIX_PATH_MAX]; | 35 char redirectsockname[PATH_MAX]; |
36 size_t argsize; | 36 size_t argsize; |
37 const char **args; | 37 const char **args; |
38 }; | 38 }; |
39 | 39 |
40 static void initcmdserveropts(struct cmdserveropts *opts) { | 40 static void initcmdserveropts(struct cmdserveropts *opts) { |
128 } | 128 } |
129 | 129 |
130 static void setcmdserveropts(struct cmdserveropts *opts) | 130 static void setcmdserveropts(struct cmdserveropts *opts) |
131 { | 131 { |
132 int r; | 132 int r; |
133 char sockdir[UNIX_PATH_MAX]; | 133 char sockdir[PATH_MAX]; |
134 const char *envsockname = getenv("CHGSOCKNAME"); | 134 const char *envsockname = getenv("CHGSOCKNAME"); |
135 if (!envsockname) { | 135 if (!envsockname) { |
136 /* by default, put socket file in secure directory | 136 /* by default, put socket file in secure directory |
137 * (permission of socket file may be ignored on some Unices) */ | 137 * (permission of socket file may be ignored on some Unices) */ |
138 const char *tmpdir = getenv("TMPDIR"); | 138 const char *tmpdir = getenv("TMPDIR"); |