X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibudev%2Flibudev-monitor.c;h=2ad9e1c3adbc1d134d36f31f8b557382dde49fab;hb=ac7019f33f1618f5b69ed44a8623e2596f1e3856;hp=566e9761aa0eb55beef90384f7faa3e33f36f09a;hpb=c195956988799837b763ab1b9f078e5f0b7f26e6;p=elogind.git diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index 566e9761a..2ad9e1c3a 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -494,6 +494,11 @@ tag: * * Only socket connections with uid=0 are accepted. * + * The monitor socket is by default set to NONBLOCK. A variant of poll() on + * the file descriptor returned by udev_monitor_get_fd() should to be used to + * wake up when new devices arrive, or alternatively the file descriptor + * switched into blocking mode. + * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev device. * @@ -578,7 +583,7 @@ retry: nlh->magic, htonl(UDEV_MONITOR_MAGIC)); return NULL; } - if (nlh->properties_off+32 > buflen) + if (nlh->properties_off+32 > (size_t)buflen) return NULL; bufpos = nlh->properties_off; } else {