efl vpath: Check and terminate execution if set*uid() calls fail

Summary:
Quells warnings:
    lib/efl/interfaces/efl_vpath_core.c:117:9: warning: ignoring return
    value of ‘setuid’, declared with attribute warn_unused_result
    [-Wunused-result]
         setuid(geteuid());
         ^
    lib/efl/interfaces/efl_vpath_core.c:169:9: warning: ignoring return
    value of ‘setreuid’, declared with attribute warn_unused_result
    [-Wunused-result]
         setreuid(uid, geteuid());
         ^

Reviewers: raster, jpeg

Reviewed By: raster

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4768
This commit is contained in:
Bryce Harrington 2017-04-13 16:41:02 +09:00 committed by Carsten Haitzler (Rasterman)
parent 5cba6a5857
commit 8b95b78dee
1 changed files with 14 additions and 2 deletions

View File

@ -114,7 +114,13 @@ _efl_vpath_core_efl_object_constructor(Eo *obj, Efl_Vpath_Core_Data *pd)
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
uid = getuid();
setuid(geteuid());
if (setuid(geteuid()) != 0)
{
fprintf(stderr,
"FATAL: Cannot setuid - errno=%i\n",
errno);
abort();
}
#endif
// fallback - make ~/.run
snprintf(buf, sizeof(buf), "%s/.run", home);
@ -166,7 +172,13 @@ _efl_vpath_core_efl_object_constructor(Eo *obj, Efl_Vpath_Core_Data *pd)
}
}
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
setreuid(uid, geteuid());
if (setreuid(uid, geteuid()) != 0)
{
fprintf(stderr,
"FATAL: Cannot setreuid - errno=%i\n",
errno);
abort();
};
#endif
}
if (!s) s = (char *)efl_vpath_core_meta_get(obj, "tmp");