File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -918,9 +918,6 @@ static int process_special_crash(const char *context[], int input_fd) {
918918
919919 log_notice ("Detected coredump of the journal daemon or PID 1, diverted to %s." , filename );
920920
921- log_notice ("Due to the special circumstances, coredump collection will now be turned off." );
922- (void ) write_string_file ("/proc/sys/kernel/core_pattern" , "|/bin/false" , 0 );
923-
924921 return 0 ;
925922}
926923
@@ -980,6 +977,12 @@ static int process_kernel(int argc, char* argv[]) {
980977
981978 if (cg_pid_get_unit (pid , & t ) >= 0 ) {
982979
980+ /* If this is PID 1 disable coredump collection, we'll unlikely be able to process it later on. */
981+ if (streq (t , SPECIAL_INIT_SCOPE )) {
982+ log_notice ("Due to PID 1 having crashed coredump collection will now be turned off." );
983+ (void ) write_string_file ("/proc/sys/kernel/core_pattern" , "|/bin/false" , 0 );
984+ }
985+
983986 /* Let's avoid dead-locks when processing journald and init crashes, as socket activation and logging
984987 * are unlikely to work then. */
985988 if (STR_IN_SET (t , SPECIAL_JOURNALD_SERVICE , SPECIAL_INIT_SCOPE )) {
You can’t perform that action at this time.
0 commit comments