aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1993-09-06 23:28:42 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1993-09-06 23:28:42 +0000
commit4710700ef6a944a886c0a37d01712a521e8c2781 (patch)
tree89079c45e8a75d3cba0e03611b6c7096cd5d0dcd /usr.sbin/pkg_install
parentdf33e97f457b72e98435144e35767942493210e4 (diff)
downloadsrc-4710700ef6a944a886c0a37d01712a521e8c2781.tar.gz
src-4710700ef6a944a886c0a37d01712a521e8c2781.zip
Fixed bug in copying script files from absolute locations
Notes
Notes: svn path=/head/; revision=404
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/lib/file.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index 106a5351564c..2b69bbf2dc8d 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -110,8 +110,14 @@ write_file(char *name, char *str)
void
copy_file(char *dir, char *fname, char *to)
{
- if (vsystem("cp -p -r %s/%s %s", dir, fname, to))
- barf("Couldn't copy %s/%s to %s!", dir, fname, to);
+ char cmd[FILENAME_MAX];
+
+ if (fname[0] == '/')
+ sprintf(cmd, "cp -p -r %s %s", fname, to);
+ else
+ sprintf(cmd, "cp -p -r %s/%s %s", dir, fname, to);
+ if (vsystem(cmd))
+ barf("Couldn't perform '%s'", cmd);
}
/*