Consider the following very basic program, which appeared in many forms on other issues.
#include <string.h>
int main() {
char message[8];
strcpy(message, "Hello, world!");
}
On my system, if I put this in a file with a name Classic.c, compile it without special flags and run it, I get the following output.
$ gcc -o Classic Class.c
$ ./Classic
*** stack smashing detected ***: ./Classic terminated
Aborted (core dumped)
Typically, the output of the program goes to stderror stdout, so I expected that the following would not produce an output.
./Classic 2> /dev/null > /dev/null
However, the conclusion is exactly the same, so I have three questions for this scenario.
- What stream is printed here?
- How can I write code that prints this special thread (without breaking my stack intentionally).
- How to redirect the output of this stream?
Note. I am running on a Linux system. In particular, Ubuntu 14.04.