summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch/fetch.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2006-11-10 22:05:41 +0000
committerdes <des@FreeBSD.org>2006-11-10 22:05:41 +0000
commit7ae37b64c40cee10aeeb6da05783a95ffabf37f1 (patch)
tree2950e4a38cb2256ea074fe310a0f552cda912376 /usr.bin/fetch/fetch.c
parent1aa7069d4fd3ef52c7de92f26bb3c5ba909b70f1 (diff)
downloadFreeBSD-src-7ae37b64c40cee10aeeb6da05783a95ffabf37f1.zip
FreeBSD-src-7ae37b64c40cee10aeeb6da05783a95ffabf37f1.tar.gz
Try to preserve ownership and permissions when replacing an existing file.
PR: bin/104702 Submitted by: Kevin Day <toasty@dragondata.com> MFC after: 1 week
Diffstat (limited to 'usr.bin/fetch/fetch.c')
-rw-r--r--usr.bin/fetch/fetch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 027c6f6..d19a257 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -569,6 +569,8 @@ fetch(char *URL, const char *path)
if (tmppath != NULL) {
mkstemps(tmppath, strlen(slash) + 1);
of = fopen(tmppath, "w");
+ chown(tmppath, sb.st_uid, sb.st_gid);
+ chmod(tmppath, sb.st_mode & ALLPERMS);
}
}
if (of == NULL)
OpenPOWER on IntegriCloud