diff options
| author | 2016-11-17 10:06:08 +0000 | |
|---|---|---|
| committer | 2016-11-17 10:06:08 +0000 | |
| commit | 700b11ff8d317b85df756fd489cd2e4d1d6e5baf (patch) | |
| tree | b8054bafc0f5e8b9886e00ba9ef4176d3ea25a0b /usr.bin/tmux/xmalloc.c | |
| parent | Add ofp_validate() for all supported versions. Will be used by switchctl, (diff) | |
| download | wireguard-openbsd-700b11ff8d317b85df756fd489cd2e4d1d6e5baf.tar.xz wireguard-openbsd-700b11ff8d317b85df756fd489cd2e4d1d6e5baf.zip | |
Key running commands for #() by the unexpanded command, and run them
again if the expanded form changes (otherwise at most once per second as
usual). Fixes issues reported by Gregory Pakosz.
Diffstat (limited to 'usr.bin/tmux/xmalloc.c')
| -rw-r--r-- | usr.bin/tmux/xmalloc.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/tmux/xmalloc.c b/usr.bin/tmux/xmalloc.c index d1a3dc587c6..367db15ea52 100644 --- a/usr.bin/tmux/xmalloc.c +++ b/usr.bin/tmux/xmalloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xmalloc.c,v 1.10 2016/04/04 16:19:43 nicm Exp $ */ +/* $OpenBSD: xmalloc.c,v 1.11 2016/11/17 10:06:08 nicm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -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, ...) { |
