From 2528e2a752d650d6120bfc833bb6eaba4cca678f Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Tue, 4 Oct 2011 10:28:24 +1300 Subject: [PATCH] expand_tilde: use strdup() instead of malloc()/strcpy(). The OpenBSD linker complains about the reference to strcpy(). Pointed out by Jasper Lievisse Adriaanse . --- util/util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/util/util.c b/util/util.c index 0289676..68426fb 100644 --- a/util/util.c +++ b/util/util.c @@ -348,11 +348,9 @@ char *expand_tilde(const char *path) last_error()); } } else { - expanded = (char *)malloc(strlen(path) + 1); + expanded = strdup(path); - if (expanded) - strcpy(expanded, path); - else + if (!expanded) printc_err("%s: malloc: %s\n", __FUNCTION__, last_error()); }