Skip to content

Commit 1013977

Browse files
committed
refactor: support core file check / directory
1 parent 84af0f1 commit 1013977

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

agent/src/utils/environment/linux.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ impl CoreFileProcessor<'_> {
283283
}
284284

285285
fn check(&self) {
286+
const DEFAILT_CORE_DIR: &str = "/";
287+
286288
match self {
287289
CoreFileProcessor::Dir(core_path) => {
288290
// core_path example:
@@ -320,6 +322,8 @@ impl CoreFileProcessor<'_> {
320322
if let Some((_left, right)) = line.rsplit_once("=") {
321323
info!("Check core-files in dir: {}", right.trim());
322324
self.check_abrt_dir(right.trim());
325+
info!("Check core-files in dir: {}", DEFAILT_CORE_DIR);
326+
self.check_core_file_dir(DEFAILT_CORE_DIR);
323327
return;
324328
}
325329
}
@@ -332,6 +336,8 @@ impl CoreFileProcessor<'_> {
332336

333337
info!("Check core-files in dir: {}", CORE_DIR);
334338
self.check_abrt_dir(CORE_DIR);
339+
info!("Check core-files in dir: {}", DEFAILT_CORE_DIR);
340+
self.check_core_file_dir(DEFAILT_CORE_DIR);
335341
}
336342
// ubuntu
337343
CoreFileProcessor::Process("apport") => {
@@ -349,6 +355,8 @@ impl CoreFileProcessor<'_> {
349355
if let Some((_left, right)) = line.rsplit_once("=") {
350356
info!("Check core-files in dir: {}", right.trim());
351357
self.check_core_file_dir(right.trim());
358+
info!("Check core-files in dir: {}", DEFAILT_CORE_DIR);
359+
self.check_core_file_dir(DEFAILT_CORE_DIR);
352360
break;
353361
}
354362
}
@@ -361,6 +369,8 @@ impl CoreFileProcessor<'_> {
361369

362370
info!("Check core-files in dir: {}", CORE_DIR);
363371
self.check_core_file_dir(CORE_DIR);
372+
info!("Check core-files in dir: {}", DEFAILT_CORE_DIR);
373+
self.check_core_file_dir(DEFAILT_CORE_DIR);
364374
}
365375
CoreFileProcessor::Process(name) => {
366376
info!(

0 commit comments

Comments
 (0)