Skip to content

Commit

Permalink
Clean the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Zelenchuk committed Mar 29, 2024
1 parent ceb642d commit 58104f3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mimidump.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int main(int argc, char **argv)
char pcap_out_filename[PCAP_FILENAME_SIZE];

pthread_attr_t attr;
unsigned int mSleep = 100000; /* Sleep 0.1 second */
unsigned int mSleep = 100000; /* Sleep 0.1 second */
size_t num_threads = 2;
int s;
void *res;
Expand Down Expand Up @@ -163,7 +163,7 @@ int main(int argc, char **argv)
/* open capture device */
handle_inout = pcap_open_live(dev, SNAP_LEN, 1, 1000, errbuf);
if (handle_inout == NULL) {

/* If device is not up, sleep 0.1 second and try again */
if (strstr(errbuf, "device is not up") != NULL) {
usleep(mSleep);
Expand Down Expand Up @@ -199,7 +199,7 @@ int main(int argc, char **argv)
if (pcap_setfilter(handle_inout, &bprog) < 0) {

sprintf(errbuf, "%s", pcap_geterr(handle_inout));

if (strstr(errbuf, "Network is down") != NULL) {
usleep(mSleep);
continue;
Expand All @@ -226,7 +226,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Error installing OUT bpf filter: %s\n", errbuf);
exit(EXIT_FAILURE);
}

/* All looks good */
break;
}
Expand Down Expand Up @@ -306,4 +306,3 @@ int main(int argc, char **argv)
pcap_close(handle_out);
return 0;
}

0 comments on commit 58104f3

Please sign in to comment.