Get rid of PATH_MAX
There could be no upper limit on the length of a path according to POSIX, therefore these macros may not be defined at all on some systems (such as GNU Hurd). There is however a limit on sizeof(struct sockaddr_un.sun_path), so use it. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcb/-/merge_requests/65>
This commit is contained in:
parent
daf2c53976
commit
6a7661f60a
|
@ -104,7 +104,9 @@ static int _xcb_parse_display_path_to_socket(const char *name, char **host, char
|
||||||
int *displayp, int *screenp)
|
int *displayp, int *screenp)
|
||||||
{
|
{
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
char path[PATH_MAX];
|
/* In addition to the AF_UNIX path, there may be a screen number.
|
||||||
|
* The trailing \0 is already accounted in the size of sun_path. */
|
||||||
|
char path[sizeof(((struct sockaddr_un*)0)->sun_path) + 1 + 10];
|
||||||
size_t len;
|
size_t len;
|
||||||
int _screen = 0, res;
|
int _screen = 0, res;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue