diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /gnu/libexec/uucp/libunix/link.c |
initial import of NetBSD tree
Diffstat (limited to 'gnu/libexec/uucp/libunix/link.c')
-rw-r--r-- | gnu/libexec/uucp/libunix/link.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libunix/link.c b/gnu/libexec/uucp/libunix/link.c new file mode 100644 index 00000000000..4550c76c94d --- /dev/null +++ b/gnu/libexec/uucp/libunix/link.c @@ -0,0 +1,38 @@ +/* link.c + Link two files. */ + +#include "uucp.h" + +#include "uudefs.h" +#include "sysdep.h" +#include "system.h" + +#include <errno.h> + +boolean +fsysdep_link (zfrom, zto, pfworked) + const char *zfrom; + const char *zto; + boolean *pfworked; +{ + *pfworked = FALSE; + if (link (zfrom, zto) == 0) + { + *pfworked = TRUE; + return TRUE; + } + if (errno == ENOENT) + { + if (! fsysdep_make_dirs (zto, TRUE)) + return FALSE; + if (link (zfrom, zto) == 0) + { + *pfworked = TRUE; + return TRUE; + } + } + if (errno == EXDEV) + return TRUE; + ulog (LOG_ERROR, "link (%s, %s): %s", zfrom, zto, strerror (errno)); + return FALSE; +} |