commit - a1c232cd01d5cdefe98b5cc36304114a6874fb3b
commit + 6a76b2a232c7a2636e9b2060bee394f867a760b8
blob - d4e8a40971cdef4fdb032ef56e0a43a25a977ec9
blob + 79ed4eb381c97f07cb9e77ed8c6882740d9ea545
--- modules/weather.c
+++ modules/weather.c
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
#include <unistd.h>
#include "statbar.h"
{
ssize_t n = read(fd, weather_string, sizeof(weather_string));
char *lnbrk;
+ char garbage[1024];
+ int flags = fcntl(fd, F_GETFL, 0);
if (n < 0)
{
}
lnbrk = strchr(weather_string, '\n');
if (lnbrk) *lnbrk = '\0';
+ (void)fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ while (read(fd, garbage, sizeof(garbage)) > 0);
+ (void)fcntl(fd, F_SETFL, flags);
}
void