The question is a bit tricky but it is quite simple.
Have a shared code in C, and I would like to "ban" some function (typically system()
). There will be a replacement function (eg. my_system()
). This replacement function will use the original function but with integrated checks.
I have made some research and find the keyword poison
:
#pragma GCC poison system
And I can declare my custom function before the pragma:
int my_system (const char *line){
...
system(line_ok);
...
}
Is it the right way to proceed?