From 8186dc11a90dbc310acaad7ee867ee995adbd6ed Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Sun, 13 Jan 2008 11:08:59 +0100 Subject: Ensure correct dir permissions in the database. Fix for FS#9176. A previous commit (6e8daa553bbd5) already forced all database files to 644. Now the directories are also forced to 755. Additionally, repo-add now sets the umask to 022, just like makepkg does, to fix the problem at its root. Signed-off-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/util.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/libalpm/util.c') diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index d09b9b14..5959482d 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -399,6 +399,8 @@ int _alpm_unpack(const char *archive, const char *prefix, const char *fn) if(S_ISREG(st->st_mode)) { archive_entry_set_mode(entry, 0644); + } else if(S_ISDIR(st->st_mode)) { + archive_entry_set_mode(entry, 0755); } if (fn && strcmp(fn, entryname)) { -- cgit v1.2.3-24-g4f1b From 801a26805663b0a79bf619a0fec853293806969b Mon Sep 17 00:00:00 2001 From: Jaroslaw Swierczynski Date: Sun, 13 Jan 2008 15:06:25 +0100 Subject: FS#9183 : force correct permissions on tmp/. [Xav: removed unneeded makepath_internal function, and fixed the permission value : 1777 -> 01777] Signed-off-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/util.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/util.c') diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 5959482d..e1413a25 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -178,8 +178,13 @@ char* strsep(char** str, const char* delims) } #endif -/* does the same thing as 'mkdir -p' */ int _alpm_makepath(const char *path) +{ + return(_alpm_makepath_mode(path, 0755)); +} + +/* does the same thing as 'mkdir -p' */ +int _alpm_makepath_mode(const char *path, mode_t mode) { char *orig, *str, *ptr; char full[PATH_MAX] = ""; @@ -196,7 +201,7 @@ int _alpm_makepath(const char *path) strcat(full, "/"); strcat(full, ptr); if(stat(full, &buf)) { - if(mkdir(full, 0755)) { + if(mkdir(full, mode)) { FREE(orig); umask(oldmask); _alpm_log(PM_LOG_ERROR, _("failed to make path '%s' : %s\n"), -- cgit v1.2.3-24-g4f1b