forked from enlightenment/efl
ecore con - also be paranoid with same nul byte checks in path str
this won't affect the target system which doesn't do abstract sockets anyway, and it's just unlink "" ... but check if first byte is nul for an asbtract socket and dont do lock files or unlinking in this case
This commit is contained in:
parent
0802f4dc95
commit
6a0de945e0
|
@ -61,8 +61,6 @@ _efl_net_server_unix_bind_hang_lock_workaround(const char *address, Eina_Bool lo
|
||||||
char *lockfile;
|
char *lockfile;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (strncmp(address, "abstract:", strlen("abstract:")) == 0) return -1;
|
|
||||||
|
|
||||||
addrlen = strlen(address);
|
addrlen = strlen(address);
|
||||||
lockfile = malloc(addrlen + 1 + 5);
|
lockfile = malloc(addrlen + 1 + 5);
|
||||||
if (!lockfile) return -1;
|
if (!lockfile) return -1;
|
||||||
|
@ -189,15 +187,18 @@ _efl_net_server_unix_bind(Eo *o, Efl_Net_Server_Unix_Data *pd)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BIND_HANG_WORKAROUND
|
#ifdef BIND_HANG_WORKAROUND
|
||||||
pd->lock_fd = _efl_net_server_unix_bind_hang_lock_workaround
|
if (addr.sun_path[0] != '\0')
|
||||||
(address, EINA_TRUE, -1);
|
|
||||||
if (pd->lock_fd < 0)
|
|
||||||
{
|
{
|
||||||
err = EADDRINUSE;
|
pd->lock_fd = _efl_net_server_unix_bind_hang_lock_workaround
|
||||||
goto error;
|
(addr.sun_path, EINA_TRUE, -1);
|
||||||
|
if (pd->lock_fd < 0)
|
||||||
|
{
|
||||||
|
err = EADDRINUSE;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
pd->have_lock_fd = EINA_TRUE;
|
||||||
|
unlink(addr.sun_path);
|
||||||
}
|
}
|
||||||
unlink(addr.sun_path);
|
|
||||||
pd->have_lock_fd = EINA_TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
r = bind(fd, (struct sockaddr *)&addr, addrlen);
|
r = bind(fd, (struct sockaddr *)&addr, addrlen);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
|
|
Loading…
Reference in New Issue