xref: /titanic_50/usr/src/lib/libresolv2/common/isc/movefile.c (revision 9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829)
1*9525b14bSRao Shoaib /*
2*9525b14bSRao Shoaib  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3*9525b14bSRao Shoaib  * Use is subject to license terms.
4*9525b14bSRao Shoaib  */
5*9525b14bSRao Shoaib 
6*9525b14bSRao Shoaib 
7*9525b14bSRao Shoaib /*
8*9525b14bSRao Shoaib  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
9*9525b14bSRao Shoaib  * Copyright (c) 2000 by Internet Software Consortium, Inc.
10*9525b14bSRao Shoaib  *
11*9525b14bSRao Shoaib  * Permission to use, copy, modify, and distribute this software for any
12*9525b14bSRao Shoaib  * purpose with or without fee is hereby granted, provided that the above
13*9525b14bSRao Shoaib  * copyright notice and this permission notice appear in all copies.
14*9525b14bSRao Shoaib  *
15*9525b14bSRao Shoaib  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
16*9525b14bSRao Shoaib  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17*9525b14bSRao Shoaib  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
18*9525b14bSRao Shoaib  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19*9525b14bSRao Shoaib  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20*9525b14bSRao Shoaib  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21*9525b14bSRao Shoaib  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22*9525b14bSRao Shoaib  */
23*9525b14bSRao Shoaib 
24*9525b14bSRao Shoaib 
25*9525b14bSRao Shoaib #include <port_before.h>
26*9525b14bSRao Shoaib #include <stdio.h>
27*9525b14bSRao Shoaib #include <isc/misc.h>
28*9525b14bSRao Shoaib #include <port_after.h>
29*9525b14bSRao Shoaib #ifndef HAVE_MOVEFILE
30*9525b14bSRao Shoaib /*
31*9525b14bSRao Shoaib  * rename() is lame (can't overwrite an existing file) on some systems.
32*9525b14bSRao Shoaib  * use movefile() instead, and let lame OS ports do what they need to.
33*9525b14bSRao Shoaib  */
34*9525b14bSRao Shoaib 
35*9525b14bSRao Shoaib int
isc_movefile(const char * oldname,const char * newname)36*9525b14bSRao Shoaib isc_movefile(const char *oldname, const char *newname) {
37*9525b14bSRao Shoaib 	return (rename(oldname, newname));
38*9525b14bSRao Shoaib }
39*9525b14bSRao Shoaib #else
40*9525b14bSRao Shoaib 	static int os_port_has_isc_movefile = 1;
41*9525b14bSRao Shoaib #endif
42*9525b14bSRao Shoaib 
43*9525b14bSRao Shoaib /*! \file */
44