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 <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2023-06-04 15:27:29 +01:00
parent e8889fd107
commit a61ab37b67
+2 -2
View File
@@ -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