summaryrefslogtreecommitdiffstats
path: root/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'clock.c')
-rw-r--r--clock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/clock.c b/clock.c
index c3040f4..846854d 100644
--- a/clock.c
+++ b/clock.c
@@ -246,6 +246,7 @@ int
main(int argc, char *argv[])
{
int timerfd = -1, tcset = 0, old_flags = -1, old_sig = 0, owner_set = 0;
+ int saved_errno;
struct itimerspec itimerspec;
struct sigaction sigact;
struct termios stty, saved_stty;
@@ -338,9 +339,11 @@ main(int argc, char *argv[])
return 0;
fail:
- perror(argv0 ? argv0 : "clock");
+ saved_errno = errno;
fprintf(stdout, "\033[?25h\n\033[?1049l");
fflush(stdout);
+ errno = saved_errno;
+ perror(argv0 ? argv0 : "clock");
if (owner_set)
fcntl(STDIN_FILENO, F_SETOWN_EX, &old_owner);
if (old_flags != -1)