os: Report errors opening authorization file (#469)

Fixes: xorg/xserver#469

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7fb6338c68)
This commit is contained in:
Alan Coopersmith 2019-01-01 16:49:32 -08:00 committed by Adam Jackson
parent 7b0f6102df
commit c091ea5e38

View File

@ -42,6 +42,7 @@ from The Open Group.
#include "dixstruct.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifdef WIN32
#include <X11/Xw32defs.h>
#endif
@ -119,9 +120,15 @@ LoadAuthorization(void)
if (!authorization_file)
return 0;
errno = 0;
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;
}
while ((auth = XauReadAuth(f)) != 0) {
for (i = 0; i < NUM_AUTHORIZATION; i++) {