Skip to content

Commit 5176639

Browse files
authored
Merge pull request #112 from ellert/fixes
2 parents f67d866 + 1e530cc commit 5176639

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ target_link_libraries(XrdOssGlobus XrdOssGlobusObj)
151151
#######################
152152
add_library( XrdOssPoscObj OBJECT src/Posc.cc )
153153
set_target_properties( XrdOssPoscObj PROPERTIES POSITION_INDEPENDENT_CODE ON )
154-
target_link_libraries( XrdOssPoscObj XRootD::XrdServer XRootD::XrdUtils )
154+
target_link_libraries( XrdOssPoscObj XRootD::XrdServer XRootD::XrdUtils Threads::Threads std::atomic )
155155

156156
add_library( XrdOssPosc MODULE "$<TARGET_OBJECTS:XrdOssPoscObj>" )
157157
target_link_libraries( XrdOssPosc XrdOssPoscObj )
@@ -212,7 +212,7 @@ if( ENABLE_TESTS )
212212
if( go_install_result EQUAL 0 )
213213
find_program(GoWrk go-wrk HINTS "$ENV{HOME}/go/bin")
214214
else()
215-
message(ERROR "Failed to install the go-wrk binary" )
215+
message( WARNING "Failed to install the go-wrk binary" )
216216
endif()
217217
endif()
218218

src/HTTPFile.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int HTTPFile::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
6262
m_log.Log(LogMask::Info, "HTTPFile::Open",
6363
"File opened for append:", path);
6464
}
65-
if (Oflag & (O_RDWR | O_WRONLY)) {
65+
if ((Oflag & O_ACCMODE) != O_RDONLY) {
6666
m_write = true;
6767
m_log.Log(LogMask::Debug, "HTTPFile::Open",
6868
"File opened for writing:", path);
@@ -113,7 +113,7 @@ int HTTPFile::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
113113
m_hostname = configured_hostname;
114114
m_hostUrl = configured_hostUrl;
115115

116-
if (!Oflag) {
116+
if ((Oflag & O_ACCMODE) == O_RDONLY) {
117117
struct stat buf;
118118
auto rv = Fstat(&buf);
119119
if (rv < 0) {

src/Posc.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <XrdSec/XrdSecEntity.hh>
2525
#include <XrdSec/XrdSecEntityAttr.hh>
2626
#include <XrdSys/XrdSysError.hh>
27+
#include <XrdSys/XrdSysPlatform.hh>
2728
#include <XrdVersion.hh>
2829

2930
#include <fcntl.h>
@@ -204,10 +205,10 @@ void PoscFileSystem::ExpireFiles() {
204205
}
205206

206207
int rv;
207-
char buff[PATH_MAX];
208+
char buff[MAXPATHLEN];
208209
struct stat sb;
209210
bool supportsStatRet = dp->StatRet(&sb) == 0;
210-
while ((rv = dp->Readdir(buff, PATH_MAX)) == 0) {
211+
while ((rv = dp->Readdir(buff, sizeof(buff))) == 0) {
211212
if (buff[0] == '\0') {
212213
// No more entries
213214
break;

src/S3File.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
103103
if (Oflag & O_APPEND) {
104104
m_log.Log(LogMask::Info, "Open", "File opened for append:", path);
105105
}
106-
if (Oflag & (O_RDWR | O_WRONLY)) {
106+
if ((Oflag & O_ACCMODE) != O_RDONLY) {
107107
m_write_lk.reset(new std::mutex);
108108
}
109109

@@ -146,7 +146,7 @@ int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
146146

147147
// This flag is not set when it's going to be a read operation
148148
// so we check if the file exists in order to be able to return a 404
149-
if (!Oflag || (Oflag & O_APPEND)) {
149+
if (((Oflag & O_ACCMODE) == O_RDONLY) || (Oflag & O_APPEND)) {
150150
auto res = Fstat(nullptr);
151151
if (res < 0) {
152152
return res;

test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ if (MINIO_BIN AND MC_BIN)
205205
# Stress-test using the go-wrk binary #
206206
#######################################
207207

208+
if( GoWrk )
208209
add_test( NAME S3::s3_basic::gowrk_test
209210
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/s3-gowrk-test.sh" s3_basic )
210211

@@ -214,5 +215,6 @@ if (MINIO_BIN AND MC_BIN)
214215
ENVIRONMENT "BINARY_DIR=${CMAKE_BINARY_DIR};WRK_BIN=${GoWrk}"
215216
ATTACHED_FILES_ON_FAIL "${S3_BASIC_TEST_LOGS}"
216217
)
218+
endif()
217219

218220
endif()

test/http_tests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ TEST(TestHTTPFile, TestList) {
8989
fd->StatRet(&statStruct);
9090

9191
rc = fd->Open("/testdir", O_RDONLY, 0700, env);
92-
ASSERT_EQ(rc, -21);
92+
ASSERT_EQ(rc, -EISDIR);
9393
ASSERT_EQ(fd->Opendir("/testdir", env), 0);
9494

9595
char buf[255];
@@ -103,12 +103,12 @@ TEST(TestHTTPFile, TestXfer) {
103103

104104
struct stat si;
105105
XrdOucEnv env;
106-
auto rc = fs.Stat("/hello_world.txt", &si, 0, &env);
106+
auto rc = fs.Stat("/testdir/hello_world.txt", &si, 0, &env);
107107
ASSERT_EQ(rc, 0);
108108
ASSERT_EQ(si.st_size, 13);
109109

110110
std::unique_ptr<XrdOssDF> fh(fs.newFile());
111-
rc = fh->Open("/hello_world.txt", O_RDONLY, 0700, env);
111+
rc = fh->Open("/testdir/hello_world.txt", O_RDONLY, 0700, env);
112112
ASSERT_EQ(rc, 0);
113113

114114
char buf[12];

test/posc_tests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ TEST_F(TestPosc, TempfileUpdate) {
254254

255255
PoscFile::SetFileUpdateDuration(std::chrono::nanoseconds(100));
256256

257-
std::this_thread::sleep_for(std::chrono::milliseconds(1));
257+
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
258258

259259
PoscFile::UpdateOpenFiles();
260260

0 commit comments

Comments
 (0)