0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 07:53:06 +01:00
nodejs/test/wasi/c/link.c
cjihrig aa3360f88a
test: add WASI test for path_link()
PR-URL: https://github.com/nodejs/node/pull/32132
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-03-08 15:11:46 -04:00

18 lines
342 B
C

#include <assert.h>
#include <unistd.h>
#include <sys/stat.h>
#define OLD "/sandbox/input.txt"
#define NEW "/tmp/output.txt"
int main() {
struct stat st_old;
struct stat st_new;
assert(0 == stat(OLD, &st_old));
assert(0 == link(OLD, NEW));
assert(0 == stat(NEW, &st_new));
assert(st_old.st_ino == st_new.st_ino);
return 0;
}