From 1bac3abc07a848cfa413b0234615bfe28ce4e37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Fri, 10 Nov 2006 22:05:41 +0000 Subject: [PATCH] Try to preserve ownership and permissions when replacing an existing file. PR: bin/104702 Submitted by: Kevin Day MFC after: 1 week --- usr.bin/fetch/fetch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index 027c6f628ea..d19a25703f2 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)