Ignore EEXIST

This commit is contained in:
Night Kaly 2024-09-18 08:38:18 +01:00
parent e5894fdf69
commit 18bda0a245
Signed by: night0721
GPG key ID: 957D67B8DB7A119B

View file

@ -25,7 +25,7 @@ void error(int fatal, const char *fmt, ...)
vsnprintf(errorstr, error_len + 1, fmt, args); vsnprintf(errorstr, error_len + 1, fmt, args);
fprintf(stderr, "[zsm] "); fprintf(stderr, "[zsm] ");
if (errsv != 0) { if (errsv != 0 && errsv != EEXIST) {
perror(errorstr); perror(errorstr);
errno = 0; errno = 0;
} else { } else {
@ -56,18 +56,6 @@ void *estrdup(void *str)
return modstr; return modstr;
} }
/*
* Set socket to non blocking so epoll can use EPOLLET flag
*/
int set_nonblocking(int fd)
{
int flags = fcntl(fd, F_GETFL, 0);
if (flags == -1) {
return -1;
}
return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
}
/* /*
* Takes heap-allocated str and replace ~ with home path * Takes heap-allocated str and replace ~ with home path
* Returns heap-allocated newstr * Returns heap-allocated newstr