I wrote the below SegmentationFault.cpp:
#include <csignal>
int main() {
raise(SIGSEGV);
return 0;
}
This causes a Segmentation Fault as expected. If I run it normally (without sudo):
$./SegmentationFault
Segmentation fault (core dumped)
$
But if I run it with sudo
, it just exit sliently without any error:
$sudo ./SegmentationFault
$
Why is this?
Edit: Thanks to @Someprogrammerdude, I've update SegmentationFault.cpp to generate the error more appropriately.