From 91c8cf2367a599d429247f35efe46ac1d110a54d Mon Sep 17 00:00:00 2001 From: dwmalone Date: Thu, 3 Aug 2000 15:12:06 +0000 Subject: [PATCH] Replace two calls to strlen+calloc+strcpy with strdup. Reviewed by: sheldonh --- usr.sbin/syslogd/syslogd.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index fed82f2bb45..9b865537437 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1445,21 +1445,13 @@ cfline(line, f, prog, host) /* save hostname if any */ if (host && *host == '*') host = NULL; - if (host) { - f->f_host = calloc(1, strlen(host)+1); - if (f->f_host) { - strcpy(f->f_host, host); - } - } + if (host) + f->f_host = strdup(host); /* save program name if any */ if(prog && *prog=='*') prog = NULL; - if(prog) { - f->f_program = calloc(1, strlen(prog)+1); - if(f->f_program) { - strcpy(f->f_program, prog); - } - } + if(prog) + f->f_program = strdup(host); /* scan through the list of selectors */ for (p = line; *p && *p != '\t' && *p != ' ';) { -- 2.45.0