Re: [PATCH] mmap error handling

2005-07-29 Thread Pavel Roskin
Hi, Linus! On Thu, 2005-07-28 at 17:30 -0700, Linus Torvalds wrote: > _always_ save the value of errno before doing any other calls. Even > successful calls are perfectly allowed to change errno. OK. Fixed patch below. Signed-off-by: Pavel Roskin <[EMAIL PROTECTED]> diff --git a/diff.c b/diff

Re: [PATCH] mmap error handling

2005-07-28 Thread Linus Torvalds
On Thu, 28 Jul 2005, Morten Welinder wrote: > > > I have verified that successful close() after failed mmap() won't reset > > the output of perror() to "Success". > > Does $standard guarantee that? > > In general, successful libc calls can set errno to whatever they > please, except zero. And

Re: [PATCH] mmap error handling

2005-07-28 Thread Morten Welinder
> I have verified that successful close() after failed mmap() won't reset > the output of perror() to "Success". Does $standard guarantee that? In general, successful libc calls can set errno to whatever they please, except zero. And they sometimes do. This follows from C99. Morten - To unsubs

[PATCH] mmap error handling

2005-07-28 Thread Pavel Roskin
Hello! I have reviewed all occurrences of mmap() in git and fixed three types of errors/defects: 1) The result is not checked. 2) The file descriptor is closed if mmap() succeeds, but not when it fails. 3) Various casts applied to -1 are used instead of MAP_FAILED, which is specifically defined t