tests: add chdir in elua to prevent incorrect file accesses
Elua is testing API that tries to read files by path, prevent unintentional reads from current working directory by changing that directory.
This commit is contained in:
parent
2b86bd0b3e
commit
95d414549b
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Elua.h>
|
||||
|
@ -28,6 +29,11 @@ EFL_START_TEST(elua_api)
|
|||
st = elua_state_new("test");
|
||||
fail_if(!st);
|
||||
|
||||
/* elua APIs here try accessing files by relative path,
|
||||
* prevent any unintentional file accesses in cwd
|
||||
*/
|
||||
fail_if(chdir(TESTS_SRC_DIR));
|
||||
|
||||
/* test env vars */
|
||||
setenv("ELUA_CORE_DIR", "foo", 1);
|
||||
setenv("ELUA_MODULES_DIR", "bar", 1);
|
||||
|
|
Loading…
Reference in New Issue