Somehow, it looks like WCOREDUMP(status)
always tells me that a core
file was created.
I fork()
and when I get a SIGCHLD
signal, I use waitpid(...&status...);
.
Then when I use WIFSIGNALED(status)
, I see the expected segmentation fault with WTERMSIG(status)
(code 11) and somehow I also get true when I call WCOREDUMP(status)
.
However, by default Ubuntu is setup to not generate a core dump file. How come WCOREDUMP()
still returns true? (unless the core
file is saved somewhere else than in the current directory?)
I found out that the core dump file is generated by the kernel and sent to the apport application. The information is found in man 5 core
which has a section:
Piping core dumps to a program
This program is defined in /proc/sys/kernel/core_pattern
and on most Ubuntu systems, looks like this:
|/usr/share/apport/apport %p %s %c %P
This means pipe the core dump data to application apport, which in turn may decide to send the data to a file if
So, as far as the kernel is concerned, the core dump was generated and thus WCOREDUMP()
returning true is sensible.