diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-01-30 15:41:36 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-01-30 15:41:36 +0000 |
commit | d21915b2833b1d60110e4cdb81788860c1c0b43e (patch) | |
tree | 170191ca0a379bbfade9c61bfdbf592aea0e8925 | |
parent | df20e7a3458432d3a59fa8a5e19d2e6b2e625ca8 (diff) |
in these two cases strdup makes more sense than asprintf, pointed out by
camield@
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 10 |
1 files 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); |