Use sane umask for repo db downloads
Fixes FS#23343. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
b6cada3eed
commit
f6716ae94a
1 changed files with 5 additions and 0 deletions
|
@ -84,6 +84,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
int ret;
|
int ret;
|
||||||
|
mode_t oldmask;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
|
@ -104,6 +105,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
MALLOC(syncpath, len, RET_ERR(PM_ERR_MEMORY, -1));
|
MALLOC(syncpath, len, RET_ERR(PM_ERR_MEMORY, -1));
|
||||||
sprintf(syncpath, "%s%s", dbpath, "sync/");
|
sprintf(syncpath, "%s%s", dbpath, "sync/");
|
||||||
|
|
||||||
|
/* make sure we have a sane umask */
|
||||||
|
oldmask = umask(0022);
|
||||||
|
|
||||||
if(stat(syncpath, &buf) != 0) {
|
if(stat(syncpath, &buf) != 0) {
|
||||||
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
||||||
syncpath);
|
syncpath);
|
||||||
|
@ -124,6 +128,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
ret = _alpm_download_single_file(dbfile, db->servers, syncpath, force);
|
ret = _alpm_download_single_file(dbfile, db->servers, syncpath, force);
|
||||||
free(dbfile);
|
free(dbfile);
|
||||||
free(syncpath);
|
free(syncpath);
|
||||||
|
umask(oldmask);
|
||||||
|
|
||||||
if(ret == 1) {
|
if(ret == 1) {
|
||||||
/* files match, do nothing */
|
/* files match, do nothing */
|
||||||
|
|
Loading…
Add table
Reference in a new issue