From 146ff0f40f5f07d72d8804d567af9d967d74099a Mon Sep 17 00:00:00 2001 From: Xin LI Date: Sat, 4 Jan 2014 01:12:28 +0000 Subject: [PATCH] Make a copy instead using constant string directly when assigning to char *. While I'm there also remove a few prototypes that are unused. --- usr.sbin/rpc.lockd/lockd.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index b3402ff20c16..2974acb6ca4b 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -101,10 +101,6 @@ static void complete_service(struct netconfig *nconf, char *port_str); static void clearout_service(void); void lookup_addresses(struct netconfig *nconf); void init_nsm(void); -void nlm_prog_0(struct svc_req *, SVCXPRT *); -void nlm_prog_1(struct svc_req *, SVCXPRT *); -void nlm_prog_3(struct svc_req *, SVCXPRT *); -void nlm_prog_4(struct svc_req *, SVCXPRT *); void out_of_mem(void); void usage(void); @@ -228,7 +224,7 @@ main(int argc, char **argv) if (hosts == NULL) out_of_mem(); - hosts[0] = "*"; + hosts[0] = strdup("*"); nhosts = 1; } else { hosts_bak = hosts; @@ -244,7 +240,7 @@ main(int argc, char **argv) hosts = hosts_bak; nhosts += 2; - hosts[nhosts - 2] = "::1"; + hosts[nhosts - 2] = strdup("::1"); } else { hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); if (hosts_bak == NULL) { @@ -258,7 +254,7 @@ main(int argc, char **argv) hosts = hosts_bak; } } - hosts[nhosts - 1] = "127.0.0.1"; + hosts[nhosts - 1] = strdup("127.0.0.1"); } if (kernel_lockd) {