From e3e68f8ae0f9a8f65561b0fbdbe20576d6d279b4 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 8 Aug 2016 16:50:34 +0900 Subject: [PATCH] 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 --- src/lib/efl/interfaces/efl_vpath_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_vpath_core.c b/src/lib/efl/interfaces/efl_vpath_core.c index 6d7d422d36..19d846ff49 100644 --- a/src/lib/efl/interfaces/efl_vpath_core.c +++ b/src/lib/efl/interfaces/efl_vpath_core.c @@ -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 {