aboutsummaryrefslogtreecommitdiff
path: root/xmalloc.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-11-17 12:01:10 +0000
committerThomas Adam <thomas@xteddy.org>2016-11-17 12:01:10 +0000
commit442e49f51c07a1fc508c6889d77065b8b4894893 (patch)
tree739cfe7abbb0f08b88aaa0c452611b2559976521 /xmalloc.c
parent759953cb8d6e8ac2e95f831a320f249a5258d5a9 (diff)
parent3cf19d6dd0900dd5bbd78594af308ee88b109756 (diff)
downloadrtmux-442e49f51c07a1fc508c6889d77065b8b4894893.tar.gz
rtmux-442e49f51c07a1fc508c6889d77065b8b4894893.tar.bz2
rtmux-442e49f51c07a1fc508c6889d77065b8b4894893.zip
Merge branch 'obsd-master'
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/xmalloc.c b/xmalloc.c
index fcb8481d..22ea3540 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -81,6 +81,16 @@ xstrdup(const char *str)
return cp;
}
+char *
+xstrndup(const char *str, size_t maxlen)
+{
+ char *cp;
+
+ if ((cp = strndup(str, maxlen)) == NULL)
+ fatalx("xstrndup: %s", strerror(errno));
+ return cp;
+}
+
int
xasprintf(char **ret, const char *fmt, ...)
{