summaryrefslogtreecommitdiff
path: root/xserver/os/auth.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2019-07-27 07:57:27 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2019-07-27 07:57:27 +0000
commitd4a0bed4b91da9de86c311c7fef9a8aa9a6f500c (patch)
treea1b439049dee87bc951e190db93f5bbe8b43b0b5 /xserver/os/auth.c
parentb6bc775539a31f663f9e22ce3ccaf0aa96adf3b6 (diff)
Update to xserver 1.20.5. Tested by jsg@
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 */