summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_sync.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-20 11:49:42 -0500
committerDan McGee <dan@archlinux.org>2011-03-20 11:49:42 -0500
commitb2fde01c545286bb92f6194603817602bf9dfbe7 (patch)
tree283d93f361b09fa5479bc28db6e649e3732884f7 /lib/libalpm/be_sync.c
parent524b3389746f3ea44042050ba28b975b65e931ad (diff)
parent67c0e9cab39a536f1ca2fbf2a35fe898e3b71ef4 (diff)
downloadpacman-b2fde01c545286bb92f6194603817602bf9dfbe7.tar.xz
Merge branch 'maint'
Diffstat (limited to 'lib/libalpm/be_sync.c')
-rw-r--r--lib/libalpm/be_sync.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 6c0d2d67..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 */
@@ -429,7 +434,12 @@ static int sync_db_read(pmdb_t *db, struct archive *archive,
} else if(strcmp(line, "%PROVIDES%") == 0) {
READ_AND_STORE_ALL(pkg->provides);
} else if(strcmp(line, "%DELTAS%") == 0) {
- READ_AND_STORE_ALL(pkg->deltas);
+ /* Different than the rest because of the _alpm_delta_parse call. */
+ while(1) {
+ READ_NEXT(line);
+ if(strlen(line) == 0) break;
+ pkg->deltas = alpm_list_add(pkg->deltas, _alpm_delta_parse(line));
+ }
}
}
} else if(strcmp(filename, "files") == 0) {