Skip to content

Commit

Permalink
Fixed redirection bug with ztee
Browse files Browse the repository at this point in the history
Similar to the output file error, the buffer was not flushing and thus not
redirecting correctly, so fflush has been added after every print to stdout
  • Loading branch information
amirian28 committed Jan 23, 2015
1 parent 22c50ae commit 6ec8f0a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ztee.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void *process_queue(void* my_q)

if (!input_csv) {
fprintf(stdout, "%s", temp->data);
fflush(stdout);
}else if (find_success_only) {
find_successful_IP(temp->data);
}else {
Expand Down Expand Up @@ -346,16 +347,19 @@ void find_IP(char* my_string)
strncpy(temp, found, length);
temp[length] = '\0';
fprintf(stdout, "%s\n", temp);
fflush(stdout);
return;
} else if(i == ip_field) {
fprintf(stdout, "%s\n", found);
fflush(stdout);
return;
}
if(new_found) found = new_found+1;
new_found = strchr(found, ',');

}
fprintf(stdout, "%s\n", temp);
fflush(stdout);
}

void write_out_to_file(char* data)
Expand Down

0 comments on commit 6ec8f0a

Please sign in to comment.