|
26 | 26 | #include "storage/checksum.h" |
27 | 27 | #include "storage/checksum_impl.h" |
28 | 28 |
|
29 | | -#ifdef WIN32 |
30 | | -static int win32_pghardlink(const char *src, const char *dst); |
31 | | -#endif |
32 | | - |
33 | 29 |
|
34 | 30 | /* |
35 | 31 | * cloneFile() |
|
151 | 147 | linkFile(const char *src, const char *dst, |
152 | 148 | const char *schemaName, const char *relName) |
153 | 149 | { |
154 | | - if (pg_link_file(src, dst) < 0) |
| 150 | + if (link(src, dst) < 0) |
155 | 151 | pg_fatal("error while creating link for relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n", |
156 | 152 | schemaName, relName, src, dst, strerror(errno)); |
157 | 153 | } |
@@ -369,29 +365,10 @@ check_hard_link(void) |
369 | 365 | snprintf(new_link_file, sizeof(new_link_file), "%s/PG_VERSION.linktest", new_cluster.pgdata); |
370 | 366 | unlink(new_link_file); /* might fail */ |
371 | 367 |
|
372 | | - if (pg_link_file(existing_file, new_link_file) < 0) |
| 368 | + if (link(existing_file, new_link_file) < 0) |
373 | 369 | pg_fatal("could not create hard link between old and new data directories: %s\n" |
374 | 370 | "In link mode the old and new data directories must be on the same file system.\n", |
375 | 371 | strerror(errno)); |
376 | 372 |
|
377 | 373 | unlink(new_link_file); |
378 | 374 | } |
379 | | - |
380 | | -#ifdef WIN32 |
381 | | -/* implementation of pg_link_file() on Windows */ |
382 | | -static int |
383 | | -win32_pghardlink(const char *src, const char *dst) |
384 | | -{ |
385 | | - /* |
386 | | - * CreateHardLinkA returns zero for failure |
387 | | - * https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createhardlinka |
388 | | - */ |
389 | | - if (CreateHardLinkA(dst, src, NULL) == 0) |
390 | | - { |
391 | | - _dosmaperr(GetLastError()); |
392 | | - return -1; |
393 | | - } |
394 | | - else |
395 | | - return 0; |
396 | | -} |
397 | | -#endif |
0 commit comments