Skip to content

Commit

Permalink
util.c: Add locks around strftime() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed May 5, 2021
1 parent 49b3bb5 commit 7c1ad70
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions util.c
Expand Up @@ -4219,7 +4219,9 @@ giving localized results.

GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* fmt checked by caller */

STRFTIME_LOCK;
len = strftime(buf, buflen, fmt, &mytm);
STRFTIME_UNLOCK;

GCC_DIAG_RESTORE_STMT;

Expand Down Expand Up @@ -4248,7 +4250,9 @@ giving localized results.
while (buf) {

GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* fmt checked by caller */
STRFTIME_LOCK;
buflen = strftime(buf, bufsize, fmt, &mytm);
STRFTIME_UNLOCK;
GCC_DIAG_RESTORE_STMT;

if (inRANGE(buflen, 1, bufsize - 1))
Expand Down

0 comments on commit 7c1ad70

Please sign in to comment.