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

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)