aboutsummaryrefslogtreecommitdiff
path: root/gnu/libexec/uucp/libunix/rename.c
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-05-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1994-05-01 08:00:00 +0000
commita16f65c7d117419bd266c28a1901ef129a337569 (patch)
tree2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /gnu/libexec/uucp/libunix/rename.c
parent8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff)
This commit was manufactured to restore the state of the 1.1-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
Diffstat (limited to 'gnu/libexec/uucp/libunix/rename.c')
-rw-r--r--gnu/libexec/uucp/libunix/rename.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libunix/rename.c b/gnu/libexec/uucp/libunix/rename.c
new file mode 100644
index 000000000000..0947ef5cfaeb
--- /dev/null
+++ b/gnu/libexec/uucp/libunix/rename.c
@@ -0,0 +1,27 @@
+/* rename.c
+ Rename a file to a new name (Unix specific implementation). */
+
+#include "uucp.h"
+
+#include "sysdep.h"
+
+#include <errno.h>
+
+/* This implementation will not work on directories, but fortunately
+ we never want to rename directories. */
+
+int
+rename (zfrom, zto)
+ const char *zfrom;
+ const char *zto;
+{
+ if (link (zfrom, zto) < 0)
+ {
+ if (errno != EEXIST)
+ return -1;
+ if (unlink (zto) < 0
+ || link (zfrom, zto) < 0)
+ return -1;
+ }
+ return unlink (zfrom);
+}