From d21915b2833b1d60110e4cdb81788860c1c0b43e Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Thu, 30 Jan 2003 15:41:36 +0000 Subject: in these two cases strdup makes more sense than asprintf, pointed out by camield@ --- sbin/pfctl/pfctl_parser.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 35c4467db75..bb3196f5441 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.135 2003/01/30 15:03:49 henning Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.136 2003/01/30 15:41:35 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1155,8 +1155,8 @@ host(char *s, int mask) fprintf(stderr, "invalid netmask\n"); return (NULL); } - if (asprintf(&buf, "%s", s) == -1) - err(1, "host: asprintf"); + if ((buf = strdup(s)) == NULL) + err(1, "host: strdup"); if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) err(1, "host: malloc"); strlcpy(ps, s, strlen(s) - strlen(p) + 1); @@ -1172,8 +1172,8 @@ host(char *s, int mask) "extra netmask given\n"); return (NULL); } - if (asprintf(&buf, "%s", s) == -1) - err(1, "host: asprintf"); + if ((buf = strdup(s)) == NULL) + err(1, "host: strdup"); if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) err(1, "host: malloc"); strlcpy(ps, s, strlen(s) - strlen(p) + 1); -- cgit v1.2.3