mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-04 01:08:19 +02:00
commit bash-20200807 snapshot
This commit is contained in:
+10
-1
@@ -62,6 +62,7 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(TM_IN_SYS_TIME)
|
||||
#include <sys/types.h>
|
||||
@@ -80,6 +81,10 @@
|
||||
|
||||
#undef strchr /* avoid AIX weirdness */
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if defined (SHELL)
|
||||
extern char *get_string_value (const char *);
|
||||
#endif
|
||||
@@ -172,7 +177,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
char *start = s;
|
||||
auto char tbuf[100];
|
||||
long off;
|
||||
int i, w;
|
||||
int i, w, oerrno;
|
||||
long y;
|
||||
static short first = 1;
|
||||
#ifdef POSIX_SEMANTICS
|
||||
@@ -217,6 +222,8 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
};
|
||||
static const char *ampm[] = { "AM", "PM", };
|
||||
|
||||
oerrno = errno;
|
||||
|
||||
if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0)
|
||||
return 0;
|
||||
|
||||
@@ -716,6 +723,8 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
|
||||
out:
|
||||
if (s < endp && *format == '\0') {
|
||||
*s = '\0';
|
||||
if (s == start)
|
||||
errno = oerrno;
|
||||
return (s - start);
|
||||
} else
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user