Commit 796ee67e authored by Robert David Graham's avatar Robert David Graham
Browse files

cleanup

parent 6cc83f60
Loading
Loading
Loading
Loading
+1 −1
Changes for src/in-report.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -272,7 +272,7 @@ struct Names {
};

static struct SMACK *global_xnames;
void
static void
xname_init(void)
{
    unsigned i;
+3
Changes for src/main-initadapter.c: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ masscan_initialize_adapter(
    char ifname2[256];
    unsigned adapter_ip = 0;
    
    if (masscan == NULL)
        return -1;

    LOG(1, "initializing adapter\n");

    /*
+3 −2
Changes for src/main.c: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "output.h"             /* for outputing results */
#include "rte-ring.h"           /* producer/consumer ring buffer */
#include "rawsock-pcapfile.h"   /* for saving pcap files w/ raw packets */
#include "rawsock-pcap.h"       /* dynamically load libpcap library */
#include "smack.h"              /* Aho-corasick state-machine pattern-matcher */
#include "pixie-timer.h"        /* portable time functions */
#include "pixie-threads.h"      /* portable threads */
@@ -1440,7 +1441,6 @@ main_scan(struct Masscan *masscan)



void pcap_init(void);

/***************************************************************************
 ***************************************************************************/
@@ -1519,7 +1519,8 @@ int main(int argc, char *argv[])

    /* We need to do a separate "raw socket" initialization step. This is
     * for Windows and PF_RING. */
    pcap_init();
    if (pcap_init() != 0)
        LOG(2, "libpcap: failed to load\n");
    rawsock_init();

    /* Init some protocol parser data structures */
+5 −3
Changes for src/output.c: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -308,13 +308,14 @@ duplicate_string(const char *str)
        length = strlen(str);

    /* Allocate memory for the string */
    result = (char*)malloc(length + 1);
    result = malloc(length + 1);
    if (result == 0) {
        fprintf(stderr, "output: out of memory error\n");
        exit(1);
    }

    /* Copy the string */
    if (str)
        memcpy(result, str, length+1);
    result[length] = '\0';

@@ -512,7 +513,7 @@ output_do_rotate(struct Output *out, int is_closing)
    int err;

    /* Don't do anything if there is no file */
    if (out->fp == NULL)
    if (out == NULL || out->fp == NULL)
        return NULL;

    /* Make sure that all output has been flushed to the file */
@@ -537,7 +538,7 @@ output_do_rotate(struct Output *out, int is_closing)
                            + strlen(filename)
                            + 1  /* - */
                            + 1; /* nul */
    new_filename = (char*)malloc(new_filename_size);
    new_filename = malloc(new_filename_size);
    if (new_filename == NULL) {
        LOG(0, "rotate: out of memory error\n");
        return out->fp;
@@ -550,6 +551,7 @@ output_do_rotate(struct Output *out, int is_closing)
        err = localtime_s(&tm, &out->rotate.last);
    }
    if (err != 0) {
        free(new_filename);
        perror("gmtime(): file rotation ended");
        return out->fp;
    }
+1 −1
Changes for src/pixie-threads.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ pixie_begin_thread(

    typedef void *(*PTHREADFUNC)(void*);
    pthread_t thread_id = 0;
    (size_t)pthread_create(
    pthread_create(
                          &thread_id,
                          NULL,
                          (PTHREADFUNC)worker_thread,
Loading