diff options
Diffstat (limited to 'libX11/src/Xrm.c')
-rw-r--r-- | libX11/src/Xrm.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libX11/src/Xrm.c b/libX11/src/Xrm.c index fbc8ad293..c466cae7f 100644 --- a/libX11/src/Xrm.c +++ b/libX11/src/Xrm.c @@ -60,8 +60,8 @@ from The Open Group. #ifdef XTHREADS #include "locking.h" #endif -#include "XrmI.h" #include <X11/Xos.h> +#include <sys/stat.h> #include "Xresinternal.h" #include "Xresource.h" @@ -1594,12 +1594,13 @@ ReadInFile(_Xconst char *filename) * result that the number of bytes actually read with be <= * to the size returned by fstat. */ - GetSizeOfFile(fd, size); - - /* There might have been a problem trying to stat a file */ - if (size == -1) { - close (fd); - return (char *)NULL; + { + struct stat status_buffer; + if ( (fstat(fd, &status_buffer)) == -1 ) { + close (fd); + return (char *)NULL; + } else + size = status_buffer.st_size; } if (!(filebuf = Xmalloc(size + 1))) { /* leave room for '\0' */ |