Mercurial > gub
diff patches/guile-1.9.15-mingw-rename.patch @ 6489:840b403f7762
mingw::guile: another round of 1.9 patches.
author | Jan Nieuwenhuizen <janneke@gnu.org> |
---|---|
date | Mon, 07 Feb 2011 12:51:53 +0100 |
parents | |
children | 3a74c94552a7 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/guile-1.9.15-mingw-rename.patch Mon Feb 07 12:51:53 2011 +0100 @@ -0,0 +1,41 @@ +--- guile-1.9.15/libguile/filesys.c.orig 2011-02-07 12:07:09.984516150 +0100 ++++ guile-1.9.15/libguile/filesys.c 2011-02-07 12:11:53.627350574 +0100 +@@ -680,9 +680,10 @@ SCM_DEFINE (scm_link, "link", 2, 0, 0, + #undef FUNC_NAME + #endif /* HAVE_LINK */ + +-#ifdef HAVE_RENAME ++#if defined (HAVE_RENAME) && !defined (__MINGW32__) + #define my_rename rename +-#else ++#else /* !HAVE_RENAME || __MINGW32__ */ ++#ifndef __MINGW32__ + static int + my_rename (const char *oldname, const char *newname) + { +@@ -698,7 +699,24 @@ my_rename (const char *oldname, const ch + } + return rv; + } +-#endif ++#else /* __MINGW32__ */ ++static int ++my_rename (const char *oldname, const char *newname) ++{ ++ int rv; ++ struct stat stat; ++ ++ SCM_SYSCALL (rv = stat (newname, &stat)); ++ if (rv == 0) ++ SCM_SYSCALL (rv = unlink (newname)); ++ if (rv == 0) ++ rv = rename (oldname, newname); ++ ++ return rv; ++} ++#endif /* __MINGW32__ */ ++#endif /* !HAVE_RENAME || __MINGW32__ */ ++ + + SCM_DEFINE (scm_rename, "rename-file", 2, 0, 0, + (SCM oldname, SCM newname),