From a61ab37b67a1f860554989b6ff2491127259955f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 Jun 2023 15:27:29 +0100 Subject: util/spkmodem-recv: always set errno on err() This version of spkmodem uses err() to indicate an error, and the value of errno is used as exit status at all times, even when it is zero. When calling err(), it is intended that errno always be non-zero, so modify the code accordingly. Signed-off-by: Leah Rowe --- util/spkmodem_recv/spkmodem-recv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index 77d64637..b19c49a4 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -72,7 +72,7 @@ handle_audio(void) } if (llp == FLUSH_TIMEOUT) if (fflush(stdout) == EOF) - err(errno, NULL); + err(ERR(), NULL); if ((f2 <= FREQ_SEP_MIN) || (f2 >= FREQ_SEP_MAX) || (f1 <= FREQ_DATA_MIN) || (f1 >= FREQ_DATA_MAX)) { @@ -120,7 +120,7 @@ print_char(void) #if DEBUG long stdin_pos = 0; if ((stdin_pos = ftell(stdin)) == -1) - err(errno, NULL); + err(ERR(), NULL); printf ("%d %d %d @%ld\n", f1, f2, FREQ_DATA_THRESHOLD, stdin_pos - sizeof(frame)); #endif -- cgit v1.2.1