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