This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 93ac94cb9e Make traffic_cache_tool fail for directory spans. (#10514)
93ac94cb9e is described below
commit 93ac94cb9eed1868887ccb8a50b8fd99737832d9
Author: James Peach <[email protected]>
AuthorDate: Tue Sep 26 08:53:45 2023 +1000
Make traffic_cache_tool fail for directory spans. (#10514)
traffic_cache_tool doesn't support specifying the span as a directory, but
neither does it fail and report an error. Fix the span loader to report
an error in this case, rather than an Errata note, which is ignored.
Signed-off-by: James Peach <[email protected]>
---
src/traffic_cache_tool/CacheTool.cc | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/traffic_cache_tool/CacheTool.cc
b/src/traffic_cache_tool/CacheTool.cc
index d9baf4fe16..1442c40915 100644
--- a/src/traffic_cache_tool/CacheTool.cc
+++ b/src/traffic_cache_tool/CacheTool.cc
@@ -701,15 +701,18 @@ Span::load()
auto fs = swoc::file::status(_path, ec);
if (!swoc::file::is_readable(_path)) {
- zret = Errata(make_errno_code(EPERM), R"("{}" is not readable.)", _path);
- } else if (swoc::file::is_char_device(fs) ||
swoc::file::is_block_device(fs)) {
- zret = this->loadDevice();
- } else if (swoc::file::is_dir(fs)) {
- zret.note("Directory support not yet available");
- } else {
- zret = Errata(make_errno_code(EBADF), R"("{}" is not a valid file type)",
_path);
+ return Errata(make_errno_code(EPERM), R"("{}" is not readable.)", _path);
}
- return zret;
+
+ if (swoc::file::is_char_device(fs) || swoc::file::is_block_device(fs)) {
+ return this->loadDevice();
+ }
+
+ if (swoc::file::is_dir(fs)) {
+ return Errata("Directory support not yet available");
+ }
+
+ return Errata(make_errno_code(EBADF), R"("{}" is not a valid file type)",
_path);
}
Errata