lib/repo_sync.c: sane umask for repodata files

This commit is contained in:
Duncaen 2017-02-27 18:50:19 +01:00
parent 332fbc195a
commit e797936c40

View File

@ -74,6 +74,7 @@ xbps_get_remote_repo_string(const char *uri)
int HIDDEN int HIDDEN
xbps_repo_sync(struct xbps_handle *xhp, const char *uri) xbps_repo_sync(struct xbps_handle *xhp, const char *uri)
{ {
mode_t prev_umask;
const char *arch, *fetchstr = NULL; const char *arch, *fetchstr = NULL;
char *repodata, *lrepodir, *uri_fixedp; char *repodata, *lrepodir, *uri_fixedp;
int rv = 0; int rv = 0;
@ -130,6 +131,7 @@ xbps_repo_sync(struct xbps_handle *xhp, const char *uri)
/* /*
* Download plist index file from repository. * Download plist index file from repository.
*/ */
prev_umask = umask(022);
if ((rv = xbps_fetch_file(xhp, repodata, NULL)) == -1) { if ((rv = xbps_fetch_file(xhp, repodata, NULL)) == -1) {
/* reposync error cb */ /* reposync error cb */
fetchstr = xbps_fetch_error_string(); fetchstr = xbps_fetch_error_string();
@ -139,6 +141,7 @@ xbps_repo_sync(struct xbps_handle *xhp, const char *uri)
repodata, fetchstr ? fetchstr : strerror(errno)); repodata, fetchstr ? fetchstr : strerror(errno));
} else if (rv == 1) } else if (rv == 1)
rv = 0; rv = 0;
umask(prev_umask);
free(repodata); free(repodata);