aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/date/date.c8
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).