You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/06/28 07:09:58 UTC
[lucy-commits] svn commit: r1140440 - /incubator/lucy/trunk/core/Lucy/Store/FSFolder.c
Author: marvin
Date: Tue Jun 28 05:09:57 2011
New Revision: 1140440
URL: http://svn.apache.org/viewvc?rev=1140440&view=rev
Log:
LUCY-161 Don't use CreateHardLink under Cygwin.
Unlike othe Windows environments, Cygwin actually provides link() in unistd.h
-- so use it instead of CreateHardLink().
Modified:
incubator/lucy/trunk/core/Lucy/Store/FSFolder.c
Modified: incubator/lucy/trunk/core/Lucy/Store/FSFolder.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSFolder.c?rev=1140440&r1=1140439&r2=1140440&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSFolder.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSFolder.c Tue Jun 28 05:09:57 2011
@@ -287,35 +287,13 @@ S_is_local_entry(const CharBuf *path) {
/***************************************************************************/
-#if (defined(CHY_HAS_UNISTD_H) && !defined(CHY_HAS_WINDOWS_H))
-
-bool_t
-S_hard_link(CharBuf *from_path, CharBuf *to_path) {
- char *from8 = (char*)CB_Get_Ptr8(from_path);
- char *to8 = (char*)CB_Get_Ptr8(to_path);
-
- if (-1 == link(from8, to8)) {
- Err_set_error(Err_new(CB_newf("hard link for new file '%o' from '%o' failed: %s",
- to_path, from_path, strerror(errno))));
- return false;
- }
- else {
- return true;
- }
-}
-
-#elif defined(CHY_HAS_WINDOWS_H)
+#if (defined(CHY_HAS_WINDOWS_H) && !defined(__CYGWIN__))
// Windows.h defines INCREF and DECREF, so we include it only at the end of
// this file and undef those symbols.
#undef INCREF
#undef DECREF
-// For CreateHardLink.
-#ifdef CHY_HAS_WINDOWS_H
- #include <windows.h>
-#endif
-
#include <windows.h>
bool_t
@@ -335,5 +313,25 @@ S_hard_link(CharBuf *from_path, CharBuf
}
}
+#elif (defined(CHY_HAS_UNISTD_H))
+
+bool_t
+S_hard_link(CharBuf *from_path, CharBuf *to_path) {
+ char *from8 = (char*)CB_Get_Ptr8(from_path);
+ char *to8 = (char*)CB_Get_Ptr8(to_path);
+
+ if (-1 == link(from8, to8)) {
+ Err_set_error(Err_new(CB_newf("hard link for new file '%o' from '%o' failed: %s",
+ to_path, from_path, strerror(errno))));
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+#else
+ #error "Need either windows.h or unistd.h"
#endif /* CHY_HAS_UNISTD_H vs. CHY_HAS_WINDOWS_H */
+