about summary refs log tree commit diff
path: root/sysdeps/posix/rename.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/rename.c')
-rw-r--r--sysdeps/posix/rename.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sysdeps/posix/rename.c b/sysdeps/posix/rename.c
index 3245f9cf9c..c318081bac 100644
--- a/sysdeps/posix/rename.c
+++ b/sysdeps/posix/rename.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,34 +16,35 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
 
 /* Rename the file OLD to NEW.  */
 int
-DEFUN(rename, (old, new), CONST char *old AND CONST char *new)
+rename (old, new)
+     const char *old;
+     const char *new;
 {
   int save = errno;
-  if (__link(old, new) < 0)
+  if (__link (old, new) < 0)
     {
       if (errno == EEXIST)
 	{
 	  errno = save;
 	  /* Race condition, required for 1003.1 conformance.  */
-	  if (__unlink(new) < 0 ||
-	      __link(old, new) < 0)
+	  if (__unlink (new) < 0 ||
+	      __link (old, new) < 0)
 	    return -1;
 	}
       else
 	return -1;
     }
-  if (__unlink(old) < 0)
+  if (__unlink (old) < 0)
     {
       save = errno;
-      if (__unlink(new) == 0)
-	errno = save;
+      if (__unlink (new) == 0)
+	__set_errno (save);
       return -1;
     }
   return 0;