Correct a reversion in r1.39 which introduced a new instance of strcpy()

after r1.38 had attempted to remove them all.
This commit is contained in:
Kris Kennaway 2001-07-19 06:01:23 +00:00
parent 3ad234d4ef
commit 1da665ef09
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=79916

View File

@ -172,10 +172,12 @@ main(int argc, char **argv)
if (fexists(*argv)) /* refers to a file directly */
pkgs[ch] = realpath(*argv, pkgnames[ch]);
else { /* look for the file in the expected places */
if (!(cp = fileFindByPath(NULL, *argv)))
/* let pkg_do() fail later, so that error is reported */
pkgs[ch] = strcpy(pkgnames[ch], *argv);
else {
if (!(cp = fileFindByPath(NULL, *argv))) {
/* let pkg_do() fail later, so that error is reported */
if (s_strlcpy(pkgnames[ch], *argv, sizeof(pkgnames[ch])))
errx(1, "package name too long");
pkgs[ch] = pkgnames[ch];
} else {
if (s_strlcpy(pkgnames[ch], cp, sizeof(pkgnames[ch])))
errx(1, "package name too long");
pkgs[ch] = pkgnames[ch];