fork loop with recursive on success

master
JoYo 2016-07-11 22:18:23 -04:00
parent 5f4aad7b19
commit e41802ec85
1 changed files with 7 additions and 3 deletions

10
sins.c
View File

@ -97,8 +97,6 @@ int reproduce(void *pic_address, size_t pic_size)
pic_mutated = ((unsigned char *)pic_address)[mutation_offset] & (mutation_value % 2);
((char *)pic_address)[mutation_offset] = pic_mutated;
printf("%x\t%x\n", mutation_offset, pic_mutated);
memset(checksum, 0, SHA_SUM_LENGTH);
SHA1((const unsigned char *)pic_address, pic_size, digest);
@ -135,12 +133,18 @@ int main(int argc, const char **argv)
{
int return_value = 1;
char seed_path[SHA_SUM_LENGTH];
pid_t scrap_process_id;
strncpy(seed_path, argv[1], SHA_SUM_LENGTH);
scrap_process_id = fork();
while (return_value)
{
return_value = generation(seed_path);
if(scrap_process_id == 0)
{
return_value = generation(seed_path);
}
}
return 1;