Fix lack of error logging in some situations and fix failure to work on windows when swig is a pure Win32 (non-cygwin) compile

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11034 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-01-07 02:26:34 +00:00
commit 7c81201d28
2 changed files with 24 additions and 14 deletions

View file

@ -349,20 +349,26 @@ int test_if_compressed(const char *filename) {
int commit_to_cache(const char *src, const char *dest, int hardlink)
{
int ret = -1;
unlink(dest);
if (hardlink) {
struct stat st;
if (stat(src, &st) == 0) {
unlink(dest);
if (hardlink) {
#ifdef _WIN32
ret = CreateHardLinkA(dest, src, NULL) ? 0 : -1;
ret = CreateHardLinkA(dest, src, NULL) ? 0 : -1;
#else
ret = link(src, dest);
ret = link(src, dest);
#endif
}
if (ret == -1) {
ret = copy_file_to_cache(src, dest);
if (ret == -1) {
cc_log("failed to commit %s -> %s (%s)\n", src, dest, strerror(errno));
stats_update(STATS_ERROR);
}
if (ret == -1) {
ret = copy_file_to_cache(src, dest);
if (ret == -1) {
cc_log("failed to commit %s -> %s (%s)\n", src, dest, strerror(errno));
stats_update(STATS_ERROR);
}
}
} else {
cc_log("failed to put %s in the cache (%s)\n", src, strerror(errno));
stats_update(STATS_ERROR);
}
return ret;
}