diff options
author | jkh <jkh@FreeBSD.org> | 1993-09-06 23:28:42 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1993-09-06 23:28:42 +0000 |
commit | 3e88a4ee850d45a8fac5f062d4187bb8a388c216 (patch) | |
tree | 89079c45e8a75d3cba0e03611b6c7096cd5d0dcd /usr.sbin/pkg_install/lib | |
parent | 3b6c96ab2f4985a073d1446d930de8167b1d6f28 (diff) | |
download | FreeBSD-src-3e88a4ee850d45a8fac5f062d4187bb8a388c216.zip FreeBSD-src-3e88a4ee850d45a8fac5f062d4187bb8a388c216.tar.gz |
Fixed bug in copying script files from absolute locations
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 10 |
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 106a535..2b69bbf 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); } /* |