summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_files.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-01-03 00:18:22 -0600
committerDan McGee <dan@archlinux.org>2009-01-03 00:18:22 -0600
commita30bf868ca4cce5464f7e4aa55cd7e7d4eade9a2 (patch)
treeb1bf8a4c75855b7a3a61861ad20ff690fb5ad460 /lib/libalpm/be_files.c
parent1cc8ad6112ed07a71f356a6bb0f06f117b36b3b2 (diff)
parenta73ad4f0e3981acab7234e4b17a08a52bd273ab9 (diff)
Merge branch 'maint'
Diffstat (limited to 'lib/libalpm/be_files.c')
-rw-r--r--lib/libalpm/be_files.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index b9ff6464..31b23172 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -652,6 +652,26 @@ error:
return(-1);
}
+int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info)
+{
+ mode_t oldmask;
+ int retval = 0;
+ char *pkgpath = NULL;
+
+ oldmask = umask(0000);
+
+ pkgpath = get_pkgpath(db, info);
+
+ if((retval = mkdir(pkgpath, 0755)) != 0) {
+ _alpm_log(PM_LOG_ERROR, _("could not create directory %s: %s\n"), pkgpath, strerror(errno));
+ }
+
+ free(pkgpath);
+ umask(oldmask);
+
+ return(retval);
+}
+
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
@@ -670,10 +690,8 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
pkgpath = get_pkgpath(db, info);
- oldmask = umask(0000);
- mkdir(pkgpath, 0755);
/* make sure we have a sane umask */
- umask(0022);
+ oldmask = umask(0022);
if(strcmp(db->treename, "local") == 0) {
local = 1;