[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:28:10 +0000 |
Tim Rühsen started a new discussion on async_dns/async_dns.c:
https://gitlab.com/gnuwget/wget2/merge_requests/444#note_207965090
> +static int MAXWAITING; // Max. number of parallel DNS queries
> +static int MAXTRIES; // Max. number of tries per domain
> +static int TIMEOUT; // Max. number of ms for first try
> +
> +static int nwaiting;
> +
> +static int resolved;
> +static int failed;
> +
> +// create fname & set first row (needed for further processing with R)
> +static void prepare_file(const char *fname)
> +{
> + struct stat st;
> + FILE *fp;
> +
> + if ((stat(fname, &st) || !st.st_size) && (fp = fopen(fname, "a"))) {
This is a typical TOCTOU issue (see
https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use).
Try to avoid, e.g. first `fopen(fname, "a")` and then check with ftell(fp) if
you are a position 0 (=empty file) or not.
--
Reply to this email directly or view it on GitLab:
https://gitlab.com/gnuwget/wget2/merge_requests/444#note_207965090
You're receiving this email because of your account on gitlab.com.
- [Wget-dev] wget2 | Add c-ares support for quickly fill DNS cache in background (!444), DalmeGNU, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444),
Tim Rühsen <=
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), Tim Rühsen, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), Tim Rühsen, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), Tim Rühsen, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), DalmeGNU, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), DalmeGNU, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), Tim Rühsen, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), Tim Rühsen, 2019/08/26
- Re: [Wget-dev] wget2 | WIP: Add c-ares support for quickly fill DNS cache in background (!444), DalmeGNU, 2019/08/26