Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

os_rename.c

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1997-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: os_rename.c,v 12.2 2005/07/29 14:21:51 bostic Exp $
00008  */
00009 
00010 #include "db_config.h"
00011 
00012 #ifndef NO_SYSTEM_INCLUDES
00013 #include <sys/types.h>
00014 
00015 #include <string.h>
00016 #endif
00017 
00018 #include "db_int.h"
00019 
00020 /*
00021  * __os_rename --
00022  *      Rename a file.
00023  *
00024  * PUBLIC: int __os_rename __P((DB_ENV *,
00025  * PUBLIC:    const char *, const char *, u_int32_t));
00026  */
00027 int
00028 __os_rename(dbenv, old, new, silent)
00029         DB_ENV *dbenv;
00030         const char *old, *new;
00031         u_int32_t silent;
00032 {
00033         int ret;
00034 
00035         if (DB_GLOBAL(j_rename) != NULL)
00036                 ret = DB_GLOBAL(j_rename)(old, new);
00037         else
00038                 RETRY_CHK((rename(old, new)), ret);
00039 
00040         /*
00041          * If "silent" is not set, then errors are OK and we should not output
00042          * an error message.
00043          */
00044         if (!silent && ret != 0)
00045                 __db_err(dbenv, "rename %s %s: %s", old, new, strerror(ret));
00046         return (ret);
00047 }

Generated on Sun Dec 25 12:14:42 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2