cURL / Mailing Lists / curl-users / Single Mail


Re: curl and fallocate

From: Manfred Schwarb <>
Date: Wed, 28 Jan 2015 16:43:30 +0100

Am 28.01.2015 um 16:20 schrieb Daniel Stenberg:
> On Thu, 22 Jan 2015, Manfred Schwarb wrote:
>> Besides the fact that curl does not pre-allocate disk space (which is debatable),
> I don't think the fact that it doesn't is debatable, that's a fact. The debate is rather if (or how) we should add the ability.

Yes, that's what I meant, sorry for my poor English.

>> Curl does unconditionally truncate zero-sized files even in resume mode, which seems illogical to me.
> Why? The resume is in the other end. When creating a local file it is rather ordinary to start with a zero byte file, isn't it?

Yes, of course. The way I read the code is that in the normal (non-resume) case, the else branch is taken,
which is
           else {
    = NULL; /* open when needed */

My intention is, only when setting "-C -" on the command line, then unconditionally open in append-mode.
I quickly tested my patch suggestion, curl seems still to truncate on open in normal mode,
and opening in append mode when doing a resume download.

I think my patch only changes behavior when doing resume _and_ having a pre-existing zero-sized file.
At least that was the intention.


>> May I suggest to not truncate output files in resume mode, in any case?
> Unfortunately it feels like a very high likelyhood of breaking people's scripts and a modified long established behavior. I don't think we can do it this way.
> I think a new option is necessary to make it do this.

List admin:
Received on 2015-01-28