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