00001 /*- 00002 * See the file LICENSE for redistribution information. 00003 * 00004 * Copyright (c) 1997, 1998, 1999, 2000 00005 * Sleepycat Software. All rights reserved. 00006 */ 00007 00008 #include "config.h" 00009 00010 #ifndef lint 00011 static const char revid[] = "$Id: os__rename_8c-source.html,v 1.1 2008年06月08日 10:21:28 sebdiaz Exp $"; 00012 #endif /* not lint */ 00013 00014 #ifndef NO_SYSTEM_INCLUDES 00015 #include <sys/types.h> 00016 00017 #include <string.h> 00018 #include <unistd.h> 00019 #endif 00020 00021 #include "db_int.h" 00022 #include "os_jump.h" 00023 00024 /* 00025 * CDB___os_rename -- 00026 * Rename a file. 00027 * 00028 * PUBLIC: int CDB___os_rename __P((DB_ENV *, const char *, const char *)); 00029 */ 00030 int 00031 CDB___os_rename(dbenv, old, new) 00032 DB_ENV *dbenv; 00033 const char *old, *new; 00034 { 00035 int ret; 00036 00037 ret = CDB___db_jump.j_rename != NULL ? 00038 CDB___db_jump.j_rename(old, new) : rename(old, new); 00039 00040 if (ret == -1) { 00041 ret = CDB___os_get_errno(); 00042 CDB___db_err(dbenv, "Rename %s %s: %s", old, new, strerror(ret)); 00043 } 00044 00045 return (ret); 00046 }