]> git.tuebingen.mpg.de Git - paraslash.git/commit - fd.c
Improve error diagnostics of mmap_full_file().
authorAndre Noll <maan@systemlinux.org>
Thu, 8 Dec 2011 20:01:01 +0000 (21:01 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 30 Jan 2012 17:43:36 +0000 (18:43 +0100)
commitd9566a07057f68b0effd404e2da7817555f35383
tree3f3176d8198e11660d1f3e41592a3d3c4447f042
parente5fbc490c2c16ecfa7bce58a18e11a0f7d382b91
Improve error diagnostics of mmap_full_file().

On mmap errors, this function used to return the error code it got
from mmap(). Unfortunately, in at least two cases, this results in
rather obscure error messages:

$ para_afh -i .
main: No such device
$ touch foo; para_afh -i foo
main: Invalid argument

This simple patch specifically checks whether the given fd refers
to a directory or an empty file so that the error messages become
more readable:

$ para_afh -i .
main: failed to mmap "."
main: Is a directory
$ touch foo; para_afh -i foo
main: failed to mmap "foo"
main: file is empty
afh.c
error.h
fd.c