Skip to content

Commit

Permalink
error_prints: use ATTRIBUTE_FORMAT for static functions, too
Browse files Browse the repository at this point in the history
* src/error_prints.c (verror_msg): Add ATTRIBUTE_FORMAT.
  • Loading branch information
ldv-alt committed Feb 8, 2022
1 parent 66bab78 commit fbd6b4c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/error_prints.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
extern char *program_invocation_name;
#endif

static void
static void ATTRIBUTE_FORMAT((__printf__, 2, 0))
verror_msg(int err_no, const char *fmt, va_list p)
{
char *msg;

fflush(NULL);

/* We want to print entire message with single fprintf to ensure
* message integrity if stderr is shared with other programs.
/*
* We want to print the entire message with a single fprintf to ensure
* the message integrity if stderr is shared with other programs.
* Thus we use vasprintf + single fprintf.
*/
msg = NULL;
Expand All @@ -50,9 +51,11 @@ verror_msg(int err_no, const char *fmt, va_list p)
else
putc('\n', stderr);
}
/* We don't switch stderr to buffered, thus fprintf(stderr)
* always flushes its output and this is not necessary: */
/* fflush(stderr); */
/*
* We don't switch stderr to buffered, thus fprintf(stderr)
* always flushes its output and this is not necessary:
* fflush(stderr);
*/
}

void
Expand Down

0 comments on commit fbd6b4c

Please sign in to comment.