From 4d33206efeeacf0a20d6daabb0f5bcfa6da78a39 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 21 Mar 2009 18:48:19 +0000 Subject: Fix tests (hopefully) on Win32 for struct stat ino_t change from 16 to 64 bits. --- bin/bbackupd/BackupClientDirectoryRecord.cpp | 26 +++++++++--------- bin/bbackupd/Win32ServiceFunctions.cpp | 2 +- bin/bbackupquery/BackupQueries.cpp | 40 ++++++++++++++-------------- 3 files changed, 34 insertions(+), 34 deletions(-) (limited to 'bin') diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index 10ffe604..4ecb81d9 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -149,12 +149,12 @@ void BackupClientDirectoryRecord::SyncDirectory( // so byte order isn't considered. MD5Digest currentStateChecksum; - struct stat dest_st; + EMU_STRUCT_STAT dest_st; // Stat the directory, to get attribute info // If it's a symbolic link, we want the link target here // (as we're about to back up the contents of the directory) { - if(::stat(rLocalPath.c_str(), &dest_st) != 0) + if(EMU_STAT(rLocalPath.c_str(), &dest_st) != 0) { // The directory has probably been deleted, so // just ignore this error. In a future scan, this @@ -199,8 +199,8 @@ void BackupClientDirectoryRecord::SyncDirectory( std::vector files; bool downloadDirectoryRecordBecauseOfFutureFiles = false; - struct stat link_st; - if(::lstat(rLocalPath.c_str(), &link_st) != 0) + EMU_STRUCT_STAT link_st; + if(EMU_LSTAT(rLocalPath.c_str(), &link_st) != 0) { // Report the error (logs and // eventual email to administrator) @@ -258,7 +258,7 @@ void BackupClientDirectoryRecord::SyncDirectory( ::memset(&checksum_info, 0, sizeof(checksum_info)); struct dirent *en = 0; - struct stat file_st; + EMU_STRUCT_STAT file_st; std::string filename; while((en = ::readdir(dirHandle)) != 0) { @@ -292,7 +292,7 @@ void BackupClientDirectoryRecord::SyncDirectory( // prefer S_IFREG, S_IFDIR... int type = en->d_type; #else - if(::lstat(filename.c_str(), &file_st) != 0) + if(EMU_LSTAT(filename.c_str(), &file_st) != 0) { // Report the error (logs and // eventual email to administrator) @@ -387,7 +387,7 @@ void BackupClientDirectoryRecord::SyncDirectory( #ifdef WIN32 // We didn't stat the file before, // but now we need the information. - if(::lstat(filename.c_str(), &file_st) != 0) + if(emu_stat(filename.c_str(), &file_st) != 0) { rNotifier.NotifyFileStatFailed(this, filename, @@ -687,8 +687,8 @@ bool BackupClientDirectoryRecord::UpdateItems( // BLOCK { // Stat the file - struct stat st; - if(::lstat(filename.c_str(), &st) != 0) + EMU_STRUCT_STAT st; + if(EMU_LSTAT(filename.c_str(), &st) != 0) { rNotifier.NotifyFileStatFailed(this, filename, strerror(errno)); @@ -757,8 +757,8 @@ bool BackupClientDirectoryRecord::UpdateItems( if(!isDir && isCurrentVersion) { // Check that the object we found in the ID map doesn't exist on disc - struct stat st; - if(::stat(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT) + EMU_STRUCT_STAT st; + if(EMU_STAT(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT) { // Doesn't exist locally, but does exist on the server. // Therefore we can safely rename it to this new file. @@ -1278,8 +1278,8 @@ bool BackupClientDirectoryRecord::UpdateItems( if(isDir && isCurrentVersion) { // Check that the object doesn't exist already - struct stat st; - if(::stat(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT) + EMU_STRUCT_STAT st; + if(EMU_STAT(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT) { // Doesn't exist locally, but does exist on the server. // Therefore we can safely rename it. diff --git a/bin/bbackupd/Win32ServiceFunctions.cpp b/bin/bbackupd/Win32ServiceFunctions.cpp index 53be3bc7..2df914a7 100644 --- a/bin/bbackupd/Win32ServiceFunctions.cpp +++ b/bin/bbackupd/Win32ServiceFunctions.cpp @@ -203,7 +203,7 @@ int InstallService(const char* pConfigFileName, const std::string& rServiceName) { if (pConfigFileName != NULL) { - struct stat st; + EMU_STRUCT_STAT st; if (emu_stat(pConfigFileName, &st) != 0) { diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp index 26e4da4a..9e6bc9a5 100644 --- a/bin/bbackupquery/BackupQueries.cpp +++ b/bin/bbackupquery/BackupQueries.cpp @@ -914,8 +914,8 @@ void BackupQueries::CommandGetObject(const std::vector &args, const } // Does file exist? - struct stat st; - if(::stat(args[1].c_str(), &st) == 0 || errno != ENOENT) + EMU_STRUCT_STAT st; + if(EMU_STAT(args[1].c_str(), &st) == 0 || errno != ENOENT) { BOX_ERROR("The local file '" << args[1] << " already exists."); return; @@ -1146,8 +1146,8 @@ void BackupQueries::CommandGet(std::vector args, const bool *opts) } // Does local file already exist? (don't want to overwrite) - struct stat st; - if(::stat(localName.c_str(), &st) == 0 || errno != ENOENT) + EMU_STRUCT_STAT st; + if(EMU_STAT(localName.c_str(), &st) == 0 || errno != ENOENT) { BOX_ERROR("The local file " << localName << " already exists, " "will not overwrite it."); @@ -1227,8 +1227,8 @@ void BackupQueries::CommandCompare(const std::vector &args, const b std::string syncTimeFilename(mrConfiguration.GetKeyValue("DataDirectory") + DIRECTORY_SEPARATOR_ASCHAR); syncTimeFilename += "last_sync_start"; // Stat it to get file time - struct stat st; - if(::stat(syncTimeFilename.c_str(), &st) == 0) + EMU_STRUCT_STAT st; + if(EMU_STAT(syncTimeFilename.c_str(), &st) == 0) { // Files modified after this time shouldn't be on the server, so report errors slightly differently LatestFileUploadTime = FileModificationTime(st) - @@ -1404,8 +1404,8 @@ void BackupQueries::Compare(const std::string &rStoreDir, { bool modifiedAfterLastSync = false; - struct stat st; - if(::stat(rLocalDir.c_str(), &st) == 0) + EMU_STRUCT_STAT st; + if(EMU_STAT(rLocalDir.c_str(), &st) == 0) { if(FileAttrModificationTime(st) > rParams.LatestFileUploadTime()) @@ -1439,8 +1439,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, rParams.NotifyDirComparing(rLocalDir, rStoreDir); // Get info on the local directory - struct stat st; - if(::lstat(rLocalDir.c_str(), &st) != 0) + EMU_STRUCT_STAT st; + if(EMU_LSTAT(rLocalDir.c_str(), &st) != 0) { // What kind of error? if(errno == ENOTDIR || errno == ENOENT) @@ -1494,8 +1494,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, { bool modifiedAfterLastSync = false; - struct stat st; - if(::stat(rLocalDir.c_str(), &st) == 0) + EMU_STRUCT_STAT st; + if(EMU_STAT(rLocalDir.c_str(), &st) == 0) { if(FileAttrModificationTime(st) > rParams.LatestFileUploadTime()) @@ -1547,8 +1547,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, #ifndef HAVE_VALID_DIRENT_D_TYPE std::string fn(MakeFullPath (rLocalDir, localDirEn->d_name)); - struct stat st; - if(::lstat(fn.c_str(), &st) != 0) + EMU_STRUCT_STAT st; + if(EMU_LSTAT(fn.c_str(), &st) != 0) { THROW_EXCEPTION(CommonException, OSFileError) } @@ -1638,8 +1638,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, { int64_t fileSize = 0; - struct stat st; - if(::stat(localPath.c_str(), &st) == 0) + EMU_STRUCT_STAT st; + if(EMU_STAT(localPath.c_str(), &st) == 0) { fileSize = st.st_size; } @@ -1771,8 +1771,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, { bool modifiedAfterLastSync = false; - struct stat st; - if(::stat(localPath.c_str(), &st) == 0) + EMU_STRUCT_STAT st; + if(EMU_STAT(localPath.c_str(), &st) == 0) { if(FileModificationTime(st) > rParams.LatestFileUploadTime()) @@ -1845,8 +1845,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, bool modifiedAfterLastSync = false; // Check the dir modification time - struct stat st; - if(::stat(localPath.c_str(), &st) == 0 && + EMU_STRUCT_STAT st; + if(EMU_STAT(localPath.c_str(), &st) == 0 && FileModificationTime(st) > rParams.LatestFileUploadTime()) { -- cgit v1.2.3