summaryrefslogtreecommitdiffstats
path: root/counter.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-03-30 18:17:26 +0200
committerMattias Andrée <maandree@kth.se>2021-03-30 18:17:55 +0200
commitafe89e5f9fc443383c8067ebe870541b73c679da (patch)
tree4a52e9ed502fdd0bace255152f8219d92e089d4b /counter.c
parentAdd dice (diff)
downloadpdatools-afe89e5f9fc443383c8067ebe870541b73c679da.tar.gz
pdatools-afe89e5f9fc443383c8067ebe870541b73c679da.tar.bz2
pdatools-afe89e5f9fc443383c8067ebe870541b73c679da.tar.xz
m + Add timer
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'counter.c')
-rw-r--r--counter.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/counter.c b/counter.c
index f7bada6..1b8f637 100644
--- a/counter.c
+++ b/counter.c
@@ -174,6 +174,7 @@ int
main(int argc, char *argv[])
{
int tcset = 0, old_flags = -1, old_sig = 0, owner_set = 0;
+ int saved_errno;
struct sigaction sigact;
struct termios stty, saved_stty;
struct f_owner_ex old_owner, new_owner;
@@ -241,9 +242,11 @@ main(int argc, char *argv[])
return 0;
fail:
- perror(argv0 ? argv0 : "counter");
+ saved_errno = errno;
fprintf(stdout, "\033[?25h\n\033[?1049l");
fflush(stdout);
+ errno = saved_errno;
+ perror(argv0 ? argv0 : "counter");
if (owner_set)
fcntl(STDIN_FILENO, F_SETOWN_EX, &old_owner);
if (old_flags != -1)