summaryrefslogtreecommitdiff
path: root/lib/backupclient
diff options
context:
space:
mode:
authorMartin Ebourne <martin@ebourne.me.uk>2005-12-12 20:50:00 +0000
committerMartin Ebourne <martin@ebourne.me.uk>2005-12-12 20:50:00 +0000
commit3bedf8846f4d7a5cb38276b274662d62a36dcd52 (patch)
tree9d51de8b0f3d06ba6549a5a1958e52f592343140 /lib/backupclient
parent81d8eda2419e7a23088a98cdfc52a305c9ceac0d (diff)
Marged chris/win32/merge/07-win32-fixes at r210 to trunk
Diffstat (limited to 'lib/backupclient')
-rwxr-xr-xlib/backupclient/BackupClientFileAttributes.cpp46
-rwxr-xr-xlib/backupclient/BackupClientFileAttributes.h2
-rwxr-xr-xlib/backupclient/BackupStoreFile.cpp4
-rwxr-xr-xlib/backupclient/BackupStoreFileDiff.cpp8
-rw-r--r--lib/backupclient/BackupStoreObjectDump.cpp8
5 files changed, 61 insertions, 7 deletions
diff --git a/lib/backupclient/BackupClientFileAttributes.cpp b/lib/backupclient/BackupClientFileAttributes.cpp
index adc3a91c..7b7cd216 100755
--- a/lib/backupclient/BackupClientFileAttributes.cpp
+++ b/lib/backupclient/BackupClientFileAttributes.cpp
@@ -287,7 +287,7 @@ bool BackupClientFileAttributes::Compare(const BackupClientFileAttributes &rAttr
//
// --------------------------------------------------------------------------
void BackupClientFileAttributes::ReadAttributes(const char *Filename, bool ZeroModificationTimes, box_time_t *pModTime,
- box_time_t *pAttrModTime, int64_t *pFileSize, ino_t *pInodeNumber, bool *pHasMultipleLinks)
+ box_time_t *pAttrModTime, int64_t *pFileSize, InodeRefType *pInodeNumber, bool *pHasMultipleLinks)
{
StreamableMemBlock *pnewAttr = 0;
try
@@ -309,14 +309,46 @@ void BackupClientFileAttributes::ReadAttributes(const char *Filename, bool ZeroM
FillAttributes(*pnewAttr, Filename, st, ZeroModificationTimes);
+#ifndef WIN32
// Is it a link?
if((st.st_mode & S_IFMT) == S_IFLNK)
{
FillAttributesLink(*pnewAttr, Filename, st);
}
+#endif
FillExtendedAttr(*pnewAttr, Filename);
+#ifdef WIN32
+ //this is to catch those problems with invalid time stamps stored...
+ //need to find out the reason why - but also a catch as well.
+
+ attr_StreamFormat *pattr =
+ (attr_StreamFormat*)pnewAttr->GetBuffer();
+ ASSERT(pattr != 0);
+
+ // __time64_t winTime = BoxTimeToSeconds(
+ // pnewAttr->ModificationTime);
+
+ box_time_t bob = BoxTimeToSeconds(pattr->ModificationTime);
+ __time64_t winTime = bob;
+ if (_gmtime64(&winTime) == 0 )
+ {
+ ::syslog(LOG_ERR, "Corrupt value in store "
+ "Modification Time in file %s", Filename);
+ pattr->ModificationTime = 0;
+ }
+
+ bob = BoxTimeToSeconds(pattr->AttrModificationTime);
+ winTime = bob;
+ if (_gmtime64(&winTime) == 0 )
+ {
+ ::syslog(LOG_ERR, "Corrupt value in store "
+ "Attr Modification Time in file %s", Filename);
+ pattr->AttrModificationTime = 0;
+ }
+#endif
+
// Attributes ready. Encrypt into this block
EncryptAttr(*pnewAttr);
@@ -372,7 +404,7 @@ void BackupClientFileAttributes::FillAttributes(StreamableMemBlock &outputBlock,
pattr->FileGenerationNumber = htonl(st.st_gen);
#endif
}
-
+#ifndef WIN32
// --------------------------------------------------------------------------
//
// Function
@@ -402,6 +434,7 @@ void BackupClientFileAttributes::FillAttributesLink(StreamableMemBlock &outputBl
std::memcpy(buffer+oldSize, linkedTo, linkedToSize);
buffer[oldSize+linkedToSize] = '\0';
}
+#endif
// --------------------------------------------------------------------------
//
@@ -574,12 +607,18 @@ void BackupClientFileAttributes::WriteAttributes(const char *Filename) const
THROW_EXCEPTION(BackupStoreException, AttributesNotLoaded);
}
+#ifdef WIN32
+ ::syslog(LOG_WARNING,
+ "Cannot create symbolic links on Windows: %s",
+ Filename);
+#else
// Make a symlink, first deleting anything in the way
::unlink(Filename);
if(::symlink((char*)(pattr + 1), Filename) != 0)
{
THROW_EXCEPTION(CommonException, OSFileError)
}
+#endif
xattrOffset += std::strlen(reinterpret_cast<char*>(pattr+1))+1;
}
@@ -943,6 +982,3 @@ uint64_t BackupClientFileAttributes::GenerateAttributeHash(struct stat &st, cons
uint64_t result = *((uint64_t *)(digest.DigestAsData()));
return result;
}
-
-
-
diff --git a/lib/backupclient/BackupClientFileAttributes.h b/lib/backupclient/BackupClientFileAttributes.h
index 17124039..62ba2184 100755
--- a/lib/backupclient/BackupClientFileAttributes.h
+++ b/lib/backupclient/BackupClientFileAttributes.h
@@ -44,7 +44,7 @@ public:
void ReadAttributes(const char *Filename, bool ZeroModificationTimes = false,
box_time_t *pModTime = 0, box_time_t *pAttrModTime = 0, int64_t *pFileSize = 0,
- ino_t *pInodeNumber = 0, bool *pHasMultipleLinks = 0);
+ InodeRefType *pInodeNumber = 0, bool *pHasMultipleLinks = 0);
void WriteAttributes(const char *Filename) const;
bool IsSymLink() const;
diff --git a/lib/backupclient/BackupStoreFile.cpp b/lib/backupclient/BackupStoreFile.cpp
index d31b53bb..28d88d27 100755
--- a/lib/backupclient/BackupStoreFile.cpp
+++ b/lib/backupclient/BackupStoreFile.cpp
@@ -15,7 +15,9 @@
#include <new>
#include <string.h>
#ifndef BOX_DISABLE_BACKWARDS_COMPATIBILITY_BACKUPSTOREFILE
- #include <syslog.h>
+ #ifndef WIN32
+ #include <syslog.h>
+ #endif
#include <stdio.h>
#endif
diff --git a/lib/backupclient/BackupStoreFileDiff.cpp b/lib/backupclient/BackupStoreFileDiff.cpp
index 3699eb49..c1d0492d 100755
--- a/lib/backupclient/BackupStoreFileDiff.cpp
+++ b/lib/backupclient/BackupStoreFileDiff.cpp
@@ -12,7 +12,11 @@
#include <new>
#include <map>
#include <signal.h>
+#ifdef WIN32
+#include <time.h>
+#else
#include <sys/time.h>
+#endif
#include "BackupStoreFile.h"
#include "BackupStoreFileWire.h"
@@ -989,7 +993,11 @@ static void GenerateRecipe(BackupStoreFileEncodeStream::Recipe &rRecipe, BlocksA
for(unsigned int e = 0; e < rRecipe.size(); ++e)
{
char b[64];
+#ifdef WIN32
+ sprintf(b, "%8I64d", (int64_t)(rRecipe[e].mpStartBlock - pIndex));
+#else
sprintf(b, "%8lld", (int64_t)(rRecipe[e].mpStartBlock - pIndex));
+#endif
TRACE3("%8lld %s %8lld\n", rRecipe[e].mSpaceBefore, (rRecipe[e].mpStartBlock == 0)?" -":b, (int64_t)rRecipe[e].mBlocks);
}
}
diff --git a/lib/backupclient/BackupStoreObjectDump.cpp b/lib/backupclient/BackupStoreObjectDump.cpp
index 5f902831..8e6331c4 100644
--- a/lib/backupclient/BackupStoreObjectDump.cpp
+++ b/lib/backupclient/BackupStoreObjectDump.cpp
@@ -96,11 +96,19 @@ void BackupStoreDirectory::Dump(void *clibFileHandle, bool ToTrace)
int depends_l = 0;
if((*i)->GetDependsNewer() != 0)
{
+#ifdef WIN32
+ depends_l += ::sprintf(depends + depends_l, " depNew(%I64x)", (*i)->GetDependsNewer());
+#else
depends_l += ::sprintf(depends + depends_l, " depNew(%llx)", (*i)->GetDependsNewer());
+#endif
}
if((*i)->GetDependsOlder() != 0)
{
+#ifdef WIN32
+ depends_l += ::sprintf(depends + depends_l, " depOld(%I64x)", (*i)->GetDependsOlder());
+#else
depends_l += ::sprintf(depends + depends_l, " depOld(%llx)", (*i)->GetDependsOlder());
+#endif
}
// Output item