agent_smith.c

[code lang="cpp"]
/* agent_smith.c
* Agent Smith, reverse engineered by Carlos Macasaet
* http://www.carlos-m.net/
*/

#include
#include
#include

#include
#include

typedef int agent;

extern pid_t neo;
extern int errno;

agent smith() {
pid_t clone;
while( 1 ) {
if( kill( neo, 0 ) == -1 && errno == ESRCH )
return( 0 );

clone = fork();
if( clone != 0 ) {
while( kill( neo, SIGKILL ) );
waitpid( clone, NULL, 0 );
return( 0 );
}
}
}
[/code]

Leave a Reply