wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cach


From: Tim Rühsen
Subject: Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444)
Date: Mon, 26 Aug 2019 09:29:05 +0000



Tim Rühsen started a new discussion on async_dns/async_dns.c: 
https://gitlab.com/gnuwget/wget2/merge_requests/444#note_207965557

> +
> +     if ((stat(fname, &st) || !st.st_size) && (fp = fopen(fname, "a"))) {
> +             const char *content = 
> "MAXWAITING,TIMEOUT,MAXTRIES,RESOLVED,FAILED,TIME(sec)\n";
> +             fwrite(content, 1, strlen(content), fp);
> +             fclose(fp);
> +     }
> +}
> +
> +static void write_report(const char *fname, long exec_time_)
> +{
> +     FILE *fp;
> +     char *buf = malloc(1024);
> +     prepare_file(fname);
> +     if ((fp = fopen(fname, "a"))) {
> +             snprintf(buf, 1024, "%d,%d,%d,%d,%d,%ld\n", MAXWAITING, 
> TIMEOUT, MAXTRIES, resolved, failed, exec_time_);
> +             fwrite(buf, 1, strlen(buf), fp);

Use fprintf() here instead of malloc/snprintf/fwrite.

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/merge_requests/444#note_207965557
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]