xf86-input-inputtest: Fix build on systems without SOCK_NONBLOCK
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
parent
199b8c0853
commit
707f23dab8
|
@ -1014,7 +1014,19 @@ pre_init(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
|
|||
|
||||
unlink(driver_data->socket_path);
|
||||
|
||||
#ifdef SOCK_NONBLOCK
|
||||
driver_data->socket_fd = socket(PF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
|
||||
#else
|
||||
int fd = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
if (fd >= 0) {
|
||||
flags = fcntl(fd, F_GETFL, 0);
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
driver_data->socket_fd = fd;
|
||||
#endif
|
||||
|
||||
if (driver_data->socket_fd < 0) {
|
||||
xf86IDrvMsg(pInfo, X_ERROR, "Failed to create a socket for communication: %s\n",
|
||||
strerror(errno));
|
||||
|
|
Loading…
Reference in New Issue