diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-08-22 22:53:33 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-08-22 22:53:33 +0000 |
commit | 89586f0b7c256c39a72dfac798e1882c97b24838 (patch) | |
tree | 798ff3839023b35cd42b3d82311908df6d044b0a /source3/lib | |
parent | ba2fdbb4c841a917187b512b7021e9da287fe360 (diff) | |
download | samba-89586f0b7c256c39a72dfac798e1882c97b24838.tar.gz samba-89586f0b7c256c39a72dfac798e1882c97b24838.tar.bz2 samba-89586f0b7c256c39a72dfac798e1882c97b24838.zip |
added smb_xstrndup()
(This used to be commit 26fc20187d405702c50d1e7a38d3a94c84932bed)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index ae94b710b2..bf012b9721 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1819,6 +1819,17 @@ char *smb_xstrdup(const char *s) return s1; } +/** + strndup that aborts on malloc fail. +**/ +char *smb_xstrndup(const char *s, size_t n) +{ + char *s1 = strndup(s, n); + if (!s1) + smb_panic("smb_xstrndup: malloc fail\n"); + return s1; +} + /* vasprintf that aborts on malloc fail */ |