summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbc/libc/sys/sys5/rename.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libbc/libc/sys/sys5/rename.c')
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/rename.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/usr/src/lib/libbc/libc/sys/sys5/rename.c b/usr/src/lib/libbc/libc/sys/sys5/rename.c
index b1d99b5fbb..79b975f975 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/rename.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/rename.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,35 +18,33 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
-#include <syscall.h>
+#include <sys/syscall.h>
-int rename(path1, path2)
-char *path1, *path2;
+int
+rename(char *path1, char *path2)
{
- int ret;
- char buf1[256];
char buf2[256];
- if (strcmp(path1, "/var/adm/utmp") == 0 ||
- strcmp(path1, "/var/adm/wtmp") == 0 ||
- strcmp(path1, "/etc/utmp") == 0) {
- if (strcmp(path1, "/etc/utmp") == 0 ||
- strcmp(path1, "/var/adm/utmp") == 0)
- strcpy(path1, "/var/adm/utmpx");
- else
- strcpy(path1, "/var/adm/wtmpx");
+ if (strcmp(path1, "/etc/utmp") == 0 ||
+ strcmp(path1, "/var/adm/utmp") == 0) {
+ path1 = "/var/adm/utmpx";
+ strcpy(buf2, path2);
+ strcat(buf2, "x");
+ path2 = buf2;
+ } else if (strcmp(path1, "/var/adm/wtmp") == 0) {
+ path1 = "/var/adm/wtmpx";
strcpy(buf2, path2);
strcat(buf2, "x");
- ret = _syscall(SYS_rename, buf1, buf2);
- } else
- ret = _syscall(SYS_rename, path1, path2);
+ path2 = buf2;
+ }
- return(ret);
-}
+ return (_syscall(SYS_rename, path1, path2));
+}