summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2012-09-27 20:34:16 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2012-09-27 20:34:16 +0000
commit626a9ae4ade79dc2bb40bb8975810786fa388d5a (patch)
tree8c88fe24d01c52efb475563020fadfd73e0514a1 /usr.sbin/smtpd
parentd99d28e818e910b55d75fa81f59c4dd73dc70104 (diff)
use xstrdup() helper
ok eric@ gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/enqueue.c9
-rw-r--r--usr.sbin/smtpd/makemap.c15
-rw-r--r--usr.sbin/smtpd/map_stdio.c6
3 files changed, 10 insertions, 20 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index 2fa1190ddf8..c5aeb83ec6f 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.62 2012/09/27 12:26:35 chl Exp $ */
+/* $OpenBSD: enqueue.c,v 1.63 2012/09/27 20:34:15 chl Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -221,8 +221,8 @@ enqueue(int argc, char *argv[])
err(1, "gethostname");
if ((pw = getpwuid(getuid())) == NULL)
user = "anonymous";
- if (pw != NULL && (user = strdup(pw->pw_name)) == NULL)
- err(1, "strdup");
+ if (pw != NULL)
+ user = xstrdup(pw->pw_name, "enqueue");
build_from(fake_from, pw);
@@ -642,8 +642,7 @@ qualify_addr(char *in)
if (asprintf(&out, "%s@%s", in, host) == -1)
err(1, "qualify asprintf");
} else
- if ((out = strdup(in)) == NULL)
- err(1, "qualify strdup");
+ out = xstrdup(in, "qualify_addr");
return (out);
}
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c
index 0451c40eac0..251ad6e098a 100644
--- a/usr.sbin/smtpd/makemap.c
+++ b/usr.sbin/smtpd/makemap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemap.c,v 1.36 2012/09/19 12:59:59 eric Exp $ */
+/* $OpenBSD: makemap.c,v 1.37 2012/09/27 20:34:15 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -334,10 +334,7 @@ parse_setentry(char *line, size_t len, size_t lineno)
int
make_plain(DBT *val, char *text)
{
- val->data = strdup(text);
- if (val->data == NULL)
- err(1, "malloc");
-
+ val->data = xstrdup(text, "make_plain");
val->size = strlen(text) + 1;
return (val->size);
@@ -354,9 +351,7 @@ make_aliases(DBT *val, char *text)
val->data = NULL;
val->size = 0;
- origtext = strdup(text);
- if (origtext == NULL)
- fatal("strdup");
+ origtext = xstrdup(text, "make_aliases");
while ((subrcpt = strsep(&text, ",")) != NULL) {
/* subrcpt: strip initial whitespace. */
@@ -398,9 +393,7 @@ conf_aliases(char *cfgpath)
if (map == NULL)
return (PATH_ALIASES);
- path = strdup(map->m_config);
- if (path == NULL)
- err(1, NULL);
+ path = xstrdup(map->m_config, "conf_aliases");
p = strstr(path, ".db");
if (p == NULL || p[3] != '\0')
errx(1, "%s: %s: no .db suffix present", cfgpath, path);
diff --git a/usr.sbin/smtpd/map_stdio.c b/usr.sbin/smtpd/map_stdio.c
index ba13aaa5cd2..8f79e3843f3 100644
--- a/usr.sbin/smtpd/map_stdio.c
+++ b/usr.sbin/smtpd/map_stdio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map_stdio.c,v 1.10 2012/09/27 17:47:49 chl Exp $ */
+/* $OpenBSD: map_stdio.c,v 1.11 2012/09/27 20:34:15 chl Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -182,9 +182,7 @@ map_stdio_get_entry(void *hdl, const char *key, size_t *len)
if (strcmp(keyp, key) != 0)
continue;
- result = strdup(valp);
- if (result == NULL)
- err(1, NULL);
+ result = xstrdup(valp, "map_stdio_get_entry");
*len = strlen(result);
break;