Fixed the handling of the extremely unlikely situation of fstat failing Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-olive...@nokia.com> Signed-off-by: Erkki Seppälä <erkki.sepp...@vincit.fi> --- src/Xrm.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/Xrm.c b/src/Xrm.c index 3e68c37..fbc8ad2 100644 --- a/src/Xrm.c +++ b/src/Xrm.c @@ -1596,6 +1596,12 @@ ReadInFile(_Xconst char *filename) */ GetSizeOfFile(fd, size); + /* There might have been a problem trying to stat a file */ + if (size == -1) { + close (fd); + return (char *)NULL; + } + if (!(filebuf = Xmalloc(size + 1))) { /* leave room for '\0' */ close(fd); return (char *)NULL; -- 1.7.0.4 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel