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
This commit is contained in:
Dag-Erling Smørgrav 2006-11-10 22:05:41 +00:00
parent 6d6da6898a
commit 1bac3abc07
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164152

View File

@ -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)