|
17 | 17 | // (0.22) the null device beside a stream at one position is refused, and is |
18 | 18 | // refused as unsupported where the implementation does not state it; (0.23) a |
19 | 19 | // region at an address, zero; a read-only attenuation; the machine's memory |
20 | | -// and the resource preference. |
| 20 | +// and the resource preference; (0.25) where the volume states it, a second name |
| 21 | +// for a file reads as the first, and a name that is taken is refused. |
21 | 22 | // The terminal is not observed here, |
22 | 23 | // because a test run has none; the implementations observe it on a terminal |
23 | 24 | // they make. |
@@ -109,6 +110,25 @@ int main() { |
109 | 110 | kal_fs_remove(root, "okt.a", 5); |
110 | 111 | kal_fs_remove(root, "okt.b", 5); |
111 | 112 | } |
| 113 | + if (root.h && (kal_fs_props(root) & KAL_FS_PROP_HARD_LINKS) != 0) { |
| 114 | + kal_file f{}; |
| 115 | + if (kal_fs_open(root, "okt.h", 5, KAL_OPEN_WRITE | KAL_OPEN_CREATE | KAL_OPEN_TRUNCATE, &f) == kal_ok) { |
| 116 | + kal_stream_write(kal_fs_stream(f), "linked", 6); |
| 117 | + kal_fs_close_file(f); |
| 118 | + } |
| 119 | + check(kal_fs_hard_link(root, "okt.h", 5, root, "okt.l", 5) == kal_ok, "a file is given a second name"); |
| 120 | + char b[8] = {}; |
| 121 | + kal_file g{}; |
| 122 | + if (kal_fs_open(root, "okt.l", 5, KAL_OPEN_READ, &g) == kal_ok) { |
| 123 | + check(kal_stream_read(kal_fs_stream(g), b, sizeof b) == 6 && b[0] == 'l' && b[5] == 'd', |
| 124 | + "and the second name reads as the first"); |
| 125 | + kal_fs_close_file(g); |
| 126 | + } |
| 127 | + check(kal_fs_hard_link(root, "okt.h", 5, root, "okt.l", 5) == kal_err_exists, |
| 128 | + "a second name that is taken is refused"); |
| 129 | + kal_fs_remove(root, "okt.l", 5); |
| 130 | + kal_fs_remove(root, "okt.h", 5); |
| 131 | + } |
112 | 132 |
|
113 | 133 | if ((kal_process_props() & KAL_PROCESS_PROP_ONE_STRING) == 0 && root.h) { |
114 | 134 | // Where a program receives a vector, a joined command line has no |
|
0 commit comments