struct stat s;
const char *hotplug;
- g_io_channel_read(source, buf, 256, &count);
+ /* drain all pending events */
+ do {
+ count = read(g_io_channel_unix_get_fd(source),
+ buf, sizeof(buf));
+ } while (count > 0);
dev = udev_monitor_receive_device(uevent_monitor);
if (!dev)
gchar buf[256];
gsize count;
- g_io_channel_read(source, buf, 255, &count);
- buf[count] = '\0';
-
+ count = read(g_io_channel_unix_get_fd(source), buf, sizeof(buf));
if (buf[0] == 'q' && (count == 1 || buf[1] == '\n'))
exit(0);