Commit 26270ab1 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

Xrm.c: ReadInFile: refactor fstat error handling

We can simplify the fstat failure case now that the GetFileSize macro has been expanded inline. Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: 's avatarJulien Cristau <jcristau@debian.org> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 563318af
......@@ -1599,16 +1599,11 @@ ReadInFile(_Xconst char *filename)
*/
{
struct stat status_buffer;
if ( (fstat(fd, &status_buffer)) == -1 )
size = -1;
else
size = status_buffer.st_size;
}
/* There might have been a problem trying to stat a file */
if (size == -1) {
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' */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment