This is an automated email from the ASF dual-hosted git repository.
bcall 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 b7e33af35f Fixed asan issue for test_AIO when an argument wasn't set
on the command line (#11139)
b7e33af35f is described below
commit b7e33af35f65322100fffc07f7152b0514573c9f
Author: Bryan Call <[email protected]>
AuthorDate: Wed Mar 13 08:44:18 2024 -0700
Fixed asan issue for test_AIO when an argument wasn't set on the command
line (#11139)
---
src/iocore/aio/test_AIO.cc | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/iocore/aio/test_AIO.cc b/src/iocore/aio/test_AIO.cc
index 3daa770d52..d08eb4b62d 100644
--- a/src/iocore/aio/test_AIO.cc
+++ b/src/iocore/aio/test_AIO.cc
@@ -361,16 +361,13 @@ int
read_config(const char *config_filename)
{
std::ifstream fin(config_filename);
+ if (!fin.rdbuf()->is_open()) {
+ return (0);
+ }
+
char field_name[256];
char field_value[256];
- if (!fin.rdbuf()->is_open()) {
- fin.open("sample.cfg");
- if (!fin.rdbuf()->is_open()) {
- cout << "cannot open config files " << config_filename << endl;
- return (0);
- }
- }
while (!fin.eof()) {
field_name[0] = '\0';
fin >> field_name;
@@ -459,13 +456,20 @@ public:
#endif
int
-main(int /* argc ATS_UNUSED */, char *argv[])
+main(int argc, char *argv[])
{
int i;
- printf("input file %s\n", argv[1]);
- if (!read_config(argv[1])) {
+
+ // Read the configuration file
+ const char *config_filename = "sample.cfg";
+ if (argc == 2) {
+ config_filename = argv[1];
+ }
+ printf("configuration file: %s\n", config_filename);
+ if (!read_config(config_filename)) {
exit(1);
}
+
if (num_processors == 0) {
num_processors = ink_number_of_processors();
}