summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2011-03-19 11:22:19 +1000
committerDan McGee <dan@archlinux.org>2011-03-20 11:17:00 -0500
commitf6716ae94a5f299569b35bebb4d0aae23cd9af97 (patch)
tree53db0a1c25ec0a7ea6dd5c8d889cc8081dacee98 /lib/libalpm
parentb6cada3eed82a305dbc656baa7f046a73dcce25a (diff)
downloadpacman-f6716ae94a5f299569b35bebb4d0aae23cd9af97.tar.xz
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>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/be_sync.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index ca76105f..98516fd8 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -84,6 +84,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
struct stat buf;
size_t len;
int ret;
+ mode_t oldmask;
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));
sprintf(syncpath, "%s%s", dbpath, "sync/");
+ /* make sure we have a sane umask */
+ oldmask = umask(0022);
+
if(stat(syncpath, &buf) != 0) {
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
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);
free(dbfile);
free(syncpath);
+ umask(oldmask);
if(ret == 1) {
/* files match, do nothing */