summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog3
-rw-r--r--lib/color.c6
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 468001f8..96eaa330 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,8 @@
2021-09-06 Dmitry V. Levin <[email protected]>
+ * color.c (parse_opt): Replace asprintf followed by error(EXIT_FAILURE)
+ with xasprintf.
+
* xasprintf.c: New file.
* Makefile.am (libeu_a_SOURCES): Add it.
* libeu.h (xasprintf): New prototype.
diff --git a/lib/color.c b/lib/color.c
index 454cb7ca..e43b6143 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -188,10 +188,8 @@ valid arguments are:\n\
if (name_len == known[i].len
&& memcmp (start, known[i].name, name_len) == 0)
{
- if (asprintf (known[i].varp, "\e[%.*sm",
- (int) (env - val), val) < 0)
- error (EXIT_FAILURE, errno,
- _("cannot allocate memory"));
+ *known[i].varp =
+ xasprintf ("\e[%.*sm", (int) (env - val), val);
break;
}
}