[Box Backup-commit] COMMIT r2347 - box/trunk/test/bbackupd
boxbackup-dev at boxbackup.org
boxbackup-dev at boxbackup.org
Sat Oct 11 22:00:19 BST 2008
Author: chris
Date: 2008-10-11 22:00:18 +0100 (Sat, 11 Oct 2008)
New Revision: 2347
Modified:
box/trunk/test/bbackupd/testbbackupd.cpp
Log:
Add missing extern "C" on intercept function definitions in
testbbackupd.
Fix assignment of string constants to non-const char pointers.
Modified: box/trunk/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/trunk/test/bbackupd/testbbackupd.cpp 2008-10-11 17:44:28 UTC (rev 2346)
+++ box/trunk/test/bbackupd/testbbackupd.cpp 2008-10-11 21:00:18 UTC (rev 2347)
@@ -757,15 +757,15 @@
// This will not match the directory on the store, so a sync will start.
// We set up the next intercept for the same directory by passing NULL.
-struct dirent *readdir_test_hook_2(DIR *dir);
+extern "C" struct dirent *readdir_test_hook_2(DIR *dir);
#ifdef LINUX_WEIRD_LSTAT
-int lstat_test_hook(int ver, const char *file_name, struct stat *buf);
+extern "C" int lstat_test_hook(int ver, const char *file_name, struct stat *buf);
#else
-int lstat_test_hook(const char *file_name, struct stat *buf);
+extern "C" int lstat_test_hook(const char *file_name, struct stat *buf);
#endif
-struct dirent *readdir_test_hook_1(DIR *dir)
+extern "C" struct dirent *readdir_test_hook_1(DIR *dir)
{
#ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
intercept_setup_readdir_hook(NULL, readdir_test_hook_2);
@@ -776,7 +776,7 @@
// Second test hook, during the directory sync stage, keeps returning
// new filenames until the timer expires, then disables the intercept.
-struct dirent *readdir_test_hook_2(DIR *dir)
+extern "C" struct dirent *readdir_test_hook_2(DIR *dir)
{
if (time(NULL) >= readdir_stop_time)
{
@@ -812,9 +812,9 @@
}
#ifdef LINUX_WEIRD_LSTAT
-int lstat_test_hook(int ver, const char *file_name, struct stat *buf)
+extern "C" int lstat_test_hook(int ver, const char *file_name, struct stat *buf)
#else
-int lstat_test_hook(const char *file_name, struct stat *buf)
+extern "C" int lstat_test_hook(const char *file_name, struct stat *buf)
#endif
{
// TRACE1("lstat hook triggered for %s", file_name);
@@ -1666,7 +1666,7 @@
// create a new file to force an upload
- char* new_file = "testfiles/TestDir1/force-upload-2";
+ const char* new_file = "testfiles/TestDir1/force-upload-2";
int fd = open(new_file,
O_CREAT | O_EXCL | O_WRONLY, 0700);
if (fd <= 0)
@@ -1675,7 +1675,7 @@
}
TEST_THAT(fd > 0);
- char* control_string = "whee!\n";
+ const char* control_string = "whee!\n";
TEST_THAT(write(fd, control_string,
strlen(control_string)) ==
(int)strlen(control_string));
@@ -2418,7 +2418,7 @@
// we now have 3 seconds before bbackupd
// runs the SyncAllowScript again.
- char* sync_control_file = "testfiles"
+ const char* sync_control_file = "testfiles"
DIRECTORY_SEPARATOR "syncallowscript.control";
int fd = open(sync_control_file,
O_CREAT | O_EXCL | O_WRONLY, 0700);
@@ -2428,7 +2428,7 @@
}
TEST_THAT(fd > 0);
- char* control_string = "10\n";
+ const char* control_string = "10\n";
TEST_THAT(write(fd, control_string,
strlen(control_string)) ==
(int)strlen(control_string));
@@ -2437,7 +2437,7 @@
// this will pause backups, bbackupd will check
// every 10 seconds to see if they are allowed again.
- char* new_test_file = "testfiles"
+ const char* new_test_file = "testfiles"
DIRECTORY_SEPARATOR "TestDir1"
DIRECTORY_SEPARATOR "Added_During_Pause";
fd = open(new_test_file,
More information about the Boxbackup-commit
mailing list