Use std::abort() instead of exit().
am: d152868424
Change-Id: Ifb1f4ce9e1f7e18f65412a643bd494e1284fefc5
diff --git a/iface_fuzzer/ProtoFuzzerMutateFns.cpp b/iface_fuzzer/ProtoFuzzerMutateFns.cpp
index 09fad15..06c6cf5 100644
--- a/iface_fuzzer/ProtoFuzzerMutateFns.cpp
+++ b/iface_fuzzer/ProtoFuzzerMutateFns.cpp
@@ -30,7 +30,7 @@
result.set_type(var_spec.type());
} else {
cerr << "VarInstance with no type field: " << var_spec.DebugString();
- exit(1);
+ std::abort();
}
if (var_spec.has_name()) {
result.set_name(var_spec.name());
diff --git a/iface_fuzzer/ProtoFuzzerMutator.cpp b/iface_fuzzer/ProtoFuzzerMutator.cpp
index 4941382..619cb83 100644
--- a/iface_fuzzer/ProtoFuzzerMutator.cpp
+++ b/iface_fuzzer/ProtoFuzzerMutator.cpp
@@ -182,7 +182,7 @@
auto transform_fn = transform_fns.find(type);
if (transform_fn == transform_fns.end()) {
cerr << "Transformation function not found for type: " << type << endl;
- exit(1);
+ std::abort();
}
return transform_fn->second(var_spec);
}
@@ -199,7 +199,7 @@
auto type_spec = predefined_types_.find(name);
if (type_spec == predefined_types_.end()) {
cerr << "Predefined type not found: " << name << endl;
- exit(1);
+ std::abort();
}
return type_spec->second;
}
diff --git a/iface_fuzzer/ProtoFuzzerRunner.cpp b/iface_fuzzer/ProtoFuzzerRunner.cpp
index 708e188..3f3422f 100644
--- a/iface_fuzzer/ProtoFuzzerRunner.cpp
+++ b/iface_fuzzer/ProtoFuzzerRunner.cpp
@@ -53,7 +53,7 @@
hal_name, iface_name);
if (instance_names.empty()) {
cerr << "HAL service name not available in VINTF." << endl;
- exit(1);
+ std::abort();
}
// For fuzzing we don't care which instance of the HAL is targeted.
@@ -74,7 +74,7 @@
if (!handle) {
cerr << __func__ << ": " << dlerror() << endl;
cerr << __func__ << ": Can't load shared library: " << lib_name << endl;
- exit(1);
+ std::abort();
}
return handle;
}
@@ -87,7 +87,7 @@
if ((error = dlerror()) != NULL) {
cerr << __func__ << ": Can't find: " << function_name << endl;
cerr << error << endl;
- exit(1);
+ std::abort();
}
return function;
}
@@ -108,7 +108,7 @@
if (!hal->GetService(false, service_name.c_str())) {
cerr << __func__ << ": Failed to open HAL in binder mode." << endl;
- exit(1);
+ std::abort();
} else {
cerr << "HAL opened in binder mode." << endl;
return;
@@ -182,7 +182,7 @@
auto iface_desc = opened_ifaces_.find(iface_name);
if (iface_desc == opened_ifaces_.end()) {
cerr << "Interface is not open: " << iface_name << endl;
- exit(1);
+ std::abort();
}
FuncSpec result{};
@@ -221,7 +221,7 @@
auto comp_spec = comp_specs_.find(name);
if (comp_spec == comp_specs_.end()) {
cerr << "VTS spec not found: " << name << endl;
- exit(1);
+ std::abort();
}
return &comp_spec->second;
}
diff --git a/iface_fuzzer/ProtoFuzzerUtils.cpp b/iface_fuzzer/ProtoFuzzerUtils.cpp
index 6dbdb0a..25fab6d 100644
--- a/iface_fuzzer/ProtoFuzzerUtils.cpp
+++ b/iface_fuzzer/ProtoFuzzerUtils.cpp
@@ -86,7 +86,7 @@
struct dirent *ent;
if (!(dir = opendir(dir_path.c_str()))) {
cerr << "Could not open directory: " << dir_path << endl;
- exit(1);
+ std::abort();
}
while ((ent = readdir(dir))) {
string vts_spec_name{ent->d_name};
@@ -120,7 +120,7 @@
switch (opt) {
case 'h':
usage();
- exit(0);
+ std::abort();
case 'b':
params.binder_mode_ = true;
break;