From 45aa307f645434873daf3719908aa3287c3e14ab Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Tue, 16 Mar 2010 04:56:45 +0000 Subject: [PATCH] autosample fix (read size(1) from pipe while write size(4)) --- powersensordaemon/autosample.c | 4 ++-- powersensordaemon/powersensordaemon.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/powersensordaemon/autosample.c b/powersensordaemon/autosample.c index d72af0a..00ab7d8 100644 --- a/powersensordaemon/autosample.c +++ b/powersensordaemon/autosample.c @@ -164,8 +164,8 @@ int autosample_process(options_t *opt, int writefd, int readfd) unsigned char sample_enabled = 0; while(!return_value) { memcpy(&tmpfds, &readfds, sizeof(tmpfds)); - timeout.tv_sec = 0; - timeout.tv_usec = 1000000; + timeout.tv_sec = 1; + timeout.tv_usec = 0; int ret = select(max_fd+1, &tmpfds, NULL, NULL, &timeout); if(ret == -1 && errno != EINTR) { log_printf(ERROR, "autosample process select returned with error: %s", strerror(errno)); diff --git a/powersensordaemon/powersensordaemon.c b/powersensordaemon/powersensordaemon.c index bf03330..6b1a371 100644 --- a/powersensordaemon/powersensordaemon.c +++ b/powersensordaemon/powersensordaemon.c @@ -440,7 +440,7 @@ int main_loop(int tty_fd, int cmd_listen_fd, autosample_process_t* autosample, o FD_SET(cmd_listen_fd, &readfds); int max_fd = tty_fd > cmd_listen_fd ? tty_fd : cmd_listen_fd; - int autosample_enabled = 0; + u_int8_t autosample_enabled = 0; if(autosample->pid_ > 0) { clear_fd(autosample->write_fd_); FD_SET(autosample->write_fd_, &readfds); -- 1.7.10.4