efl vpath - make sure we check returns of mkdir just in case for errors

so vpath has a fallback if all things bad go wrong to mkdir a homedir
in /tmp and if that fails use /tmp or use / - if $HOME isnt set ... but
$HOME alwasy should be, so this is only for "a broken system".

this should fix CID 1354286
This commit is contained in:
Carsten Haitzler 2016-08-08 16:50:34 +09:00
parent b146b60974
commit e3e68f8ae0
1 changed files with 8 additions and 1 deletions

View File

@ -48,7 +48,14 @@ _efl_vpath_core_eo_base_constructor(Eo *obj, Efl_Vpath_Core_Data *pd)
struct stat st;
snprintf(bufhome, sizeof(bufhome), "/tmp/%i", (int)uid);
mkdir(bufhome, S_IRUSR | S_IWUSR | S_IXUSR);
if (mkdir(bufhome, S_IRUSR | S_IWUSR | S_IXUSR) < 0)
{
if (errno != EEXIST)
{
if (stat("/tmp", &st) == 0) home = "/tmp";
else home = "/";
}
}
if (stat(bufhome, &st) == 0) home = bufhome;
else
{