Hard links ``src`` to ``dst``, returning 0 or errno. Note that the special errno ``ENOLINK`` will be returned if ``os.link`` isn't supported by the operating system.
(src, dst)
| 366 | ENOLINK = 1998 |
| 367 | |
| 368 | def link(src, dst): |
| 369 | """Hard links ``src`` to ``dst``, returning 0 or errno. |
| 370 | |
| 371 | Note that the special errno ``ENOLINK`` will be returned if ``os.link`` isn't |
| 372 | supported by the operating system. |
| 373 | """ |
| 374 | |
| 375 | if not hasattr(os, "link"): |
| 376 | return ENOLINK |
| 377 | link_errno = 0 |
| 378 | try: |
| 379 | os.link(src, dst) |
| 380 | except OSError as e: |
| 381 | link_errno = e.errno |
| 382 | return link_errno |
| 383 | |
| 384 | |
| 385 | def link_or_copy(src, dst): |