Fix error code of List() result of Xrootd plugin.

parent e29ac512
......@@ -433,7 +433,7 @@ namespace ArcDMCXrootd {
logger.msg(WARNING, "Not getting checksum of zip constituent");
} else {
char buf[256];
if (XrdPosixXrootd::Getxattr(u.plainstr().c_str(), "xroot.cksum", &buf, sizeof(buf)) == -1) {
if (XrdPosixXrootd::Getxattr(u.plainstr().c_str(), "xroot.cksum", buf, sizeof(buf)) == -1) {
logger.msg(WARNING, "Could not get checksum of %s: %s", u.plainstr(), StrError(errno));
} else {
std::string csum(buf);
......@@ -481,6 +481,7 @@ namespace ArcDMCXrootd {
}
struct dirent* entry;
errno = 0; // reset because it is used as error indicator
while ((entry = XrdPosixXrootd::Readdir(dir))) {
FileInfo f;
if (verb > INFO_TYPE_NAME) {
......@@ -489,10 +490,12 @@ namespace ArcDMCXrootd {
}
f.SetName(entry->d_name);
files.push_back(f);
errno = 0;
}
if (errno != 0) {
logger.msg(VERBOSE, "Error while reading dir %s: %s", url.plainstr(), StrError(errno));
return DataStatus(DataStatus::ListError, errno);
int errNo = errno;
logger.msg(VERBOSE, "Error while reading dir %s: %s", url.plainstr(), StrError(errNo));
return DataStatus(DataStatus::ListError, errNo);
}
XrdPosixXrootd::Closedir(dir);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment