diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-09-04 17:32:23 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-09-04 17:32:23 +0000 |
| commit | a8ddd1926a34fc20970d9ceaad71b31fc414b1c5 (patch) | |
| tree | 4a6830d9a209e35b2b2e2513191b0f15893a28bf | |
| parent | c75a18905e308f69b01f19c3d7d613883a008e79 (diff) | |
| -rw-r--r-- | bin/date/date.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/date/date.c b/bin/date/date.c index 3ce9ee3235fb..01797084c0d6 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -382,8 +382,8 @@ strftime_ns(char * __restrict s, size_t maxsize, const char * __restrict format, bool seen_percent; seen_percent = false; - if (asprintf(&newformat, "%s", format) < 0) - err(1, "asprintf"); + if ((newformat = strdup(format)) == NULL) + err(1, "strdup"); tok = newformat; for (tok = newformat; *tok != '\0'; tok++) { switch (*tok) { @@ -405,9 +405,9 @@ strftime_ns(char * __restrict s, size_t maxsize, const char * __restrict format, suffix = tok + 1; /* * Construct a new format string from the - * prefix (i.e., the part of the old fromat + * prefix (i.e., the part of the old format * from its beginning to the currently handled - * "%N" conversion specification, the + * "%N" conversion specification), the * nanoseconds, and the suffix (i.e., the part * of the old format from the next token to the * end). |
