[LTP] [PATCH v3 2/8] syscalls/mknod02: Use relative path to avoid use of SAFE_CHDIR
Petr Vorel
pvorel@suse.cz
Tue Apr 22 15:06:45 CEST 2025
Hi Ricardo, all,
...
> +++ b/testcases/kernel/syscalls/mknod/mknod02.c
> @@ -20,7 +20,7 @@
> #define MODE_SGID 02000
> #define TEMP_DIR "testdir"
> -#define TEMP_NODE "testnode"
> +#define TEMP_NODE TEMP_DIR "/testnode"
> static struct stat buf;
> static struct passwd *user_nobody;
> @@ -37,14 +37,12 @@ static void setup(void)
> static void run(void)
> {
> - SAFE_CHDIR(TEMP_DIR);
> TST_EXP_PASS(mknod(TEMP_NODE, MODE1, 0), "mknod(%s, %o, 0)", TEMP_NODE, MODE1);
> SAFE_STAT(TEMP_NODE, &buf);
> TST_EXP_EQ_LI(buf.st_gid, 0);
> SAFE_UNLINK(TEMP_NODE);
> - SAFE_CHDIR("..");
I'm trying to figure out why the original test used SAFE_CHDIR().
IMHO mknod() should not be affected when called from an upper directory.
@Avinesh @Li did I overlook something obvious?
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
More information about the ltp
mailing list