Skip to content

Commit

Permalink
Persist the oom file when --persist-dir is specified
Browse files Browse the repository at this point in the history
Signed-off-by: Mrunal Patel <[email protected]>
  • Loading branch information
mrunalp committed Dec 11, 2019
1 parent 8ba9575 commit 82ef9c7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/conmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,14 @@ static gboolean oom_cb_cgroup_v1(int fd, GIOCondition condition, G_GNUC_UNUSED g
if (oom_fd < 0) {
nwarn("Failed to write oom file");
}
if (opt_persist_path) {
_cleanup_close_ int ctr_oom_fd = -1;
_cleanup_free_ char *ctr_oom_file_path = g_build_filename(opt_persist_path, "oom", NULL);
ctr_oom_fd = open(ctr_oom_file_path, O_CREAT, 0666);
if (ctr_oom_fd < 0) {
nwarn("Failed to write oom file");
}
}
return G_SOURCE_CONTINUE;
}
}
Expand Down

0 comments on commit 82ef9c7

Please sign in to comment.