summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/util.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-09-18 14:23:02 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-09-18 14:23:02 +0000
commit9c2027d84e17e5ebe5f48d8d85236efe74e23c7b (patch)
tree7aa1a0379517a751bd2dc280dd5644a31d3ba05f /usr.sbin/smtpd/util.c
parent1525b63ac4883d0e21cddface415d96740a2fe86 (diff)
- add xmemdup() helper.
- remove useless block in switch. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r--usr.sbin/smtpd/util.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 3458a54599f..05b98c4a05d 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.77 2012/09/16 11:53:57 gilles Exp $ */
+/* $OpenBSD: util.c,v 1.78 2012/09/18 14:23:01 eric Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -88,6 +88,18 @@ xstrdup(const char *str, const char *where)
return (r);
}
+void *
+xmemdup(const void *ptr, size_t size, const char *where)
+{
+ void *r;
+
+ if ((r = malloc(size)) == NULL)
+ errx(1, "%s: malloc(%zu)", where, size);
+ memmove(r, ptr, size);
+
+ return (r);
+}
+
int
bsnprintf(char *str, size_t size, const char *format, ...)
{