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 <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
549c2878f9
commit
801a268056
3 changed files with 9 additions and 3 deletions
|
@ -487,7 +487,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
|
||||||
/* creates a directory in $root/tmp/ for copying/extracting the scriptlet */
|
/* creates a directory in $root/tmp/ for copying/extracting the scriptlet */
|
||||||
snprintf(tmpdir, PATH_MAX, "%stmp/", root);
|
snprintf(tmpdir, PATH_MAX, "%stmp/", root);
|
||||||
if(stat(tmpdir, &buf)) {
|
if(stat(tmpdir, &buf)) {
|
||||||
_alpm_makepath(tmpdir);
|
_alpm_makepath_mode(tmpdir, 01777);
|
||||||
}
|
}
|
||||||
snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root);
|
snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root);
|
||||||
if(mkdtemp(tmpdir) == NULL) {
|
if(mkdtemp(tmpdir) == NULL) {
|
||||||
|
|
|
@ -178,8 +178,13 @@ char* strsep(char** str, const char* delims)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* does the same thing as 'mkdir -p' */
|
|
||||||
int _alpm_makepath(const char *path)
|
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 *orig, *str, *ptr;
|
||||||
char full[PATH_MAX] = "";
|
char full[PATH_MAX] = "";
|
||||||
|
@ -196,7 +201,7 @@ int _alpm_makepath(const char *path)
|
||||||
strcat(full, "/");
|
strcat(full, "/");
|
||||||
strcat(full, ptr);
|
strcat(full, ptr);
|
||||||
if(stat(full, &buf)) {
|
if(stat(full, &buf)) {
|
||||||
if(mkdir(full, 0755)) {
|
if(mkdir(full, mode)) {
|
||||||
FREE(orig);
|
FREE(orig);
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
_alpm_log(PM_LOG_ERROR, _("failed to make path '%s' : %s\n"),
|
_alpm_log(PM_LOG_ERROR, _("failed to make path '%s' : %s\n"),
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#define ASSERT(cond, action) do { if(!(cond)) { action; } } while(0)
|
#define ASSERT(cond, action) do { if(!(cond)) { action; } } while(0)
|
||||||
|
|
||||||
int _alpm_makepath(const char *path);
|
int _alpm_makepath(const char *path);
|
||||||
|
int _alpm_makepath_mode(const char *path, mode_t mode);
|
||||||
int _alpm_copyfile(const char *src, const char *dest);
|
int _alpm_copyfile(const char *src, const char *dest);
|
||||||
char *_alpm_strtrim(char *str);
|
char *_alpm_strtrim(char *str);
|
||||||
char *_alpm_strreplace(const char *str, const char *needle, const char *replace);
|
char *_alpm_strreplace(const char *str, const char *needle, const char *replace);
|
||||||
|
|
Loading…
Add table
Reference in a new issue