Popen vs system: popen as evil as a system?

pop-up buffers are output, but the system is not. what's the only difference

I understand that popen and the system run the command through the shell. However, popen () as evil as system ()?

+5
source share
2 answers

Look, all that concerns the “evil system” is, deep down, people who don’t think about the security implications of their particular precedent. The only reason for the system is “more evil” than using your own / dup / exec fork, which is used poorly, perhaps someone might enter a malicious command line. So for example

#include <stdlib.h>

int main(int argc, char** argv){
    (void) system(argv[1]);
}

, , - , , rm -rf /. , , popen.

-, fork exec, : .

, , - , .

+24

, . , . , . .

system("PAUSE") , cin.getline().

+7

All Articles