X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fio-util.c;h=cc6dfa8c1b94a29bcaf36cdb139be8dc09467178;hp=0037a37f2a458151bb62d1ec77202ac64bb76c92;hb=a0db25e25b5691e4fc0afa5f5a9a8d1ce586decf;hpb=bc983c987eb3f92eceb373ba4e1c2076b0b3ca88 diff --git a/src/basic/io-util.c b/src/basic/io-util.c index 0037a37f2..cc6dfa8c1 100644 --- a/src/basic/io-util.c +++ b/src/basic/io-util.c @@ -33,6 +33,11 @@ int flush_fd(int fd) { .events = POLLIN, }; + /* Read from the specified file descriptor, until POLLIN is not set anymore, throwing away everything + * read. Note that some file descriptors (notable IP sockets) will trigger POLLIN even when no data can be read + * (due to IP packet checksum mismatches), hence this function is only safe to be non-blocking if the fd used + * was set to non-blocking too. */ + for (;;) { char buf[LINE_MAX]; ssize_t l;