os: Report errors opening authorization file (#469)

Fixes: xorg/xserver#469

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Alan Coopersmith 2019-01-01 16:49:32 -08:00
parent a3d01ee9d0
commit 7fb6338c68

View File

@ -42,6 +42,7 @@ from The Open Group.
#include "dixstruct.h" #include "dixstruct.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h>
#ifdef WIN32 #ifdef WIN32
#include <X11/Xw32defs.h> #include <X11/Xw32defs.h>
#endif #endif
@ -119,9 +120,15 @@ LoadAuthorization(void)
if (!authorization_file) if (!authorization_file)
return 0; return 0;
errno = 0;
f = Fopen(authorization_file, "r"); f = Fopen(authorization_file, "r");
if (!f) if (!f) {
LogMessageVerb(X_ERROR, 0,
"Failed to open authorization file \"%s\": %s\n",
authorization_file,
errno != 0 ? strerror(errno) : "Unknown error");
return -1; return -1;
}
while ((auth = XauReadAuth(f)) != 0) { while ((auth = XauReadAuth(f)) != 0) {
for (i = 0; i < NUM_AUTHORIZATION; i++) { for (i = 0; i < NUM_AUTHORIZATION; i++) {