1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-30 06:25:25 +03:00

correct use of fcntl()

This commit is contained in:
Kay Sievers 2006-03-16 10:47:31 +01:00
parent 3e5e833253
commit f660222775

16
udevd.c
View File

@ -921,12 +921,24 @@ int main(int argc, char *argv[], char *envp[])
err("error getting pipes: %s", strerror(errno)); err("error getting pipes: %s", strerror(errno));
goto exit; goto exit;
} }
retval = fcntl(signal_pipe[READ_END], F_SETFL, O_NONBLOCK);
retval = fcntl(signal_pipe[READ_END], F_GETFL, 0);
if (retval < 0) { if (retval < 0) {
err("error fcntl on read pipe: %s", strerror(errno)); err("error fcntl on read pipe: %s", strerror(errno));
goto exit; goto exit;
} }
retval = fcntl(signal_pipe[WRITE_END], F_SETFL, O_NONBLOCK); retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK);
if (retval < 0) {
err("error fcntl on read pipe: %s", strerror(errno));
goto exit;
}
retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0);
if (retval < 0) {
err("error fcntl on write pipe: %s", strerror(errno));
goto exit;
}
retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK);
if (retval < 0) { if (retval < 0) {
err("error fcntl on write pipe: %s", strerror(errno)); err("error fcntl on write pipe: %s", strerror(errno));
goto exit; goto exit;