Skip to content

Commit

Permalink
Set errno when my_strftime() fails.
Browse files Browse the repository at this point in the history
The libc strftime() doesn't have any way to distinguish between
erroneous input and that which just doesn't generate any output; hence
it doesn't set errno.

But my_strftime() has logic to reasonably confidently make that
distinction, so it should set errno when it determines that it is
erroneous input.
  • Loading branch information
khwilliamson committed May 22, 2023
1 parent 3b126e8 commit 4e8e7b7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions locale.c
Expand Up @@ -7179,6 +7179,7 @@ the program, giving results based on that locale.
* platforms an invalid conversion specifier '%?' (for all illegal '?') is
* treated as a literal, but others may fail when '?' is illegal */
Safefree(buf);
SET_EINVAL;
return NULL;

strftime_success:
Expand Down

0 comments on commit 4e8e7b7

Please sign in to comment.