From: Charles Manning Date: Thu, 19 Mar 2020 03:04:35 +0000 (+1300) Subject: Add test to dereference symlink X-Git-Url: https://yaffs.net/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=957e8b6cc3e32759f67ec5ca883fecdab5636114 Add test to dereference symlink Signed-off-by: Charles Manning --- diff --git a/rtems/rtems-y-test/basic-test/yaffs-rtems-basic-test.c b/rtems/rtems-y-test/basic-test/yaffs-rtems-basic-test.c index b3ac44b..c526739 100644 --- a/rtems/rtems-y-test/basic-test/yaffs-rtems-basic-test.c +++ b/rtems/rtems-y-test/basic-test/yaffs-rtems-basic-test.c @@ -253,6 +253,7 @@ int create_delete_files_pass(char *root_path, char *test_path, int n_files, int } for (i = 0; i < n_files; i++) { + int link_fd; make_test_file_name(fname, sizeof(fname), root_path, test_path, "file-", i); make_test_file_name(lname, sizeof(lname), root_path, test_path, "link-", i); @@ -272,6 +273,18 @@ int create_delete_files_pass(char *root_path, char *test_path, int n_files, int ret = fds[i]; goto err; } + + + link_fd = open(lname, O_RDWR, 0777); + printf("opening link %s = %d\n", lname, link_fd); + + if (link_fd < 0) { + perror("opening symlink file"); + ret = link_fd; + goto err; + } + close(link_fd); + } set_uint8_t_buffer(buf, sizeof(buf), 0xAA, 1);