expand_tilde: use strdup() instead of malloc()/strcpy().

The OpenBSD linker complains about the reference to strcpy(). Pointed
out by Jasper Lievisse Adriaanse <jasper@openbsd.org>.
This commit is contained in:
Daniel Beer 2011-10-04 10:28:24 +13:00
parent 1d1323cabc
commit 2528e2a752
1 changed files with 2 additions and 4 deletions

View File

@ -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());
}