diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-09-12 03:42:24 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-09-12 03:42:24 +0200 |
commit | fee2317e973b25dc0e73603702dc686eb058b397 (patch) | |
tree | 4d9a6d50b74bc0be11a1b8a9543919c0eace3e85 /src/mongoclock.c | |
parent | signals will interrupt read on timer, so we do not have to wait for the timer to expire to exit (diff) | |
download | mongoclock-fee2317e973b25dc0e73603702dc686eb058b397.tar.gz mongoclock-fee2317e973b25dc0e73603702dc686eb058b397.tar.bz2 mongoclock-fee2317e973b25dc0e73603702dc686eb058b397.tar.xz |
update makefile + update gitignore + fix warnings + remove old implementation + add deps2
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mongoclock.c')
-rw-r--r-- | src/mongoclock.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongoclock.c b/src/mongoclock.c index 8ff3676..9d822e5 100644 --- a/src/mongoclock.c +++ b/src/mongoclock.c @@ -219,7 +219,7 @@ int main(int argc, char* argv[]) const char** digits[9]; size_t x = 0, y = 0; struct winsize winsize; - int small = 0, fd; + int small = 0, fd = -1; struct itimerspec itimerspec; char _buf[8]; @@ -247,7 +247,7 @@ int main(int argc, char* argv[]) if (caught_sigwinch) { caught_sigwinch = 0; - t (TEMP_FAILURE_RETRY(ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize))); + t (TEMP_FAILURE_RETRY(ioctl(STDOUT_FILENO, (unsigned long)TIOCGWINSZ, &winsize))); y = winsize.ws_row; x = winsize.ws_col; if (y < DY) small = 2; @@ -287,7 +287,7 @@ int main(int argc, char* argv[]) print_time(digits, y, x); - if (read(fd, _buf, 8) < 0) + if (read(fd, _buf, (size_t)8) < 0) if (errno != EINTR) goto fail; } @@ -301,7 +301,8 @@ int main(int argc, char* argv[]) perror(*argv); fprintf(stdout, "\033[?25h\n\033[?1049l"); fflush(stdout); - TEMP_FAILURE_RETRY(close(fd)); + if (fd >= 0) + TEMP_FAILURE_RETRY(close(fd)); return 1; (void) argc; } |