char *name;
};
+int exit_all = 0;
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
sockfd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
if (sockfd < 0) {
printf("Failed to create socket: %m\n");
- return NULL;
+ goto out;
}
addr.sin_family = AF_INET;
if (ret == -1) {
if (errno != EINTR) {
printf("epoll_wait: %m\n");
- return NULL;
+ goto close_socket;
}
continue;
close_socket:
close(sockfd);
+out:
+ exit_all = 1;
return NULL;
}
struct tm *now;
time_t t;
+ ret = 0;
+ if (exit_all)
+ break;
+
ret = bme280_set_sensor_mode(BME280_FORCED_MODE, dev);
if (ret) {
fprintf(stderr, "Failed to set sensor mode (code %+d).", ret);