Skip to content

Commit

Permalink
Merge pull request #1 from glatard/centos6
Browse files Browse the repository at this point in the history
CentOS6 compilation
  • Loading branch information
ValHayot authored Jun 27, 2020
2 parents 744b8b2 + 748bded commit 0e719a3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ logger.o: logger.cpp logger.h
passthrough.so: passthrough.o functions.o logger.o config.o sea.o
gcc -shared passthrough.o functions.o logger.o config.o sea.o ${debug_opts} -o passthrough.so -ldl -lpthread -lstdc++ -liniparser
test_custom.o: tests/test_custom.cpp passthrough.o sea.o config.o logger.o
gcc ${debug_opts} -std=c++11 -Wall -fPIC tests/test_custom.cpp passthrough.o sea.o config.o logger.o -o tests/test_custom -lstdc++ -liniparser -ldl -lgtest -lpthread
gcc ${debug_opts} -std=c++0x -Wall -fPIC tests/test_custom.cpp passthrough.o sea.o config.o logger.o -o tests/test_custom -lstdc++ -liniparser -ldl -lgtest -lpthread
test: test_custom.o
clean:
\rm -f logger.o functions.o passthrough.o config.o sea.o passthrough.so *.gcda *.gcov *.gcno tests/test_custom
2 changes: 2 additions & 0 deletions functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ extern "C" {
return ((funcptr_opendir)libc_opendir)(passpath);

SEA_DIR *sd = new SEA_DIR;
strcpy(sd->type, "seadir");
sd->curr_index = 0;
sd->dirnames = (char**) malloc(sizeof(char*) * sea_conf.n_sources * PATH_MAX);
sd->other_dirp = (DIR**) malloc(sizeof(DIR*) * sea_conf.n_sources - 1);

Expand Down
4 changes: 2 additions & 2 deletions sea.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ void initialize_sea_if_necessary();
struct SEA_DIR {
DIR* dirp;
DIR** other_dirp;
char type[7] = "seadir"; // mostly useless. only used in closedir to ensure struct type is right
char type[7]; // mostly useless. only used in closedir to ensure struct type is right
char** dirnames;
int curr_index = 0;
int curr_index;
};

#endif
Expand Down
8 changes: 4 additions & 4 deletions tests/test_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ TEST(Passthrough, GetCanonical) {

const char paths[6][PATH_MAX] = { "mount", "./mount/subdir", "../mount/", "/dev/shm/tmp", "/", NULL };

for(auto path: paths){
for(int i = 0 ; i < 6 ; i++){
const char * path = paths[i];
char* actualpath;
char* expected = (char*) malloc(sizeof(char*) * PATH_MAX);

Expand Down Expand Up @@ -66,8 +67,8 @@ TEST(Passthrough, CheckIfSeaPath) {

realpath("mount", path);

int i = 0;
for (auto op: oldpaths) {
for (int i = 0 ; i < 4 ; i++) {
char * op = oldpaths[i];
// need to reinitialize each time otherwise may retain tail of previous value
char passpath[PATH_MAX];
realpath("source", passpath);
Expand All @@ -84,7 +85,6 @@ TEST(Passthrough, CheckIfSeaPath) {
ASSERT_EQ(res, 0);

ASSERT_STREQ(passpath, expected);
++i;
}
}

Expand Down

0 comments on commit 0e719a3

Please sign in to comment.