Re: [PATCH] strbuf: clear errno before calling getdelim(3)
- From
René Scharfe <l.s.r@web.de>
- Date
- Aug 12, 2017, 12:21 UTC
- Message-ID
- <a6fe4020-4e3d-0561-db70-2eb87e0680c7@web.de>
- In-Reply-To
- <510f566b-3aee-98fd-9663-d97c3dcfeb96@web.de>
Am 12.08.2017 um 13:57 schrieb René Scharfe:
Show 5 quoted lines
> Update: Just noticed that on the BSDs getdelim(3) doesn't set errno > to ENOMEM on allocation failure, but does set the error indicator. > That might be an oversight on their part, but that means we > certainly *need* to check ferror(). And an unchanged errno can > mean ENOMEM there. Ugh..
I take that back. The memory allocation function called by getdelim will of course set errno on failure. I got fooled by the manpages, which don't mention ENOMEM, e.g.: https://man.openbsd.org/getdelim.
René