Files
graphene/LibOS/shim/test/regression/proc-path.c
Zhang Chen 06b71fc1a0 [LibOS] shim_namei.c: Fix input absolute path error and add test case
This bug just occurs when reading a symlink on procfs.
If input is an absolute path, it will get wrong my_dent.
So we use stat syscall to check whether the "/proc/1/root"
and "/" is same path in graphene.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
2019-04-04 08:29:41 -04:00

27 lines
529 B
C

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char ** argv)
{
struct stat root, proc_root;
if (stat("/", &root) == -1) {
perror("stat");
exit(1);
}
if (stat("/proc/1/root", &proc_root) == -1) {
perror("stat");
exit(1);
}
if (root.st_dev == proc_root.st_dev &&
root.st_ino == proc_root.st_ino) {
printf("proc path test success\n");
} else {
printf("proc path test failure\n");
}
}