summaryrefslogtreecommitdiff
path: root/xserver/os/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/os/auth.c')
-rw-r--r--xserver/os/auth.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/xserver/os/auth.c b/xserver/os/auth.c
index c7b333ca2..d3254349d 100644
--- a/xserver/os/auth.c
+++ b/xserver/os/auth.c
@@ -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
@@ -90,8 +91,7 @@ static struct protocol protocols[] = {
#endif
};
-#define NUM_AUTHORIZATION (sizeof (protocols) /\
- sizeof (struct protocol))
+#define NUM_AUTHORIZATION ARRAY_SIZE(protocols)
/*
* Initialize all classes of authorization by reading the
@@ -120,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++) {
@@ -302,6 +308,8 @@ GenerateAuthorization(unsigned name_length,
return -1;
}
+#endif /* XCSECURITY */
+
void
GenerateRandomData(int len, char *buf)
{
@@ -315,5 +323,3 @@ GenerateRandomData(int len, char *buf)
close(fd);
#endif
}
-
-#endif /* XCSECURITY */