summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-09-17 19:11:52 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-09-17 19:22:30 -0700
commit3a87227bb357ac9523f853fca84ebde3129e2f05 (patch)
tree14730a0ff33839972e3aea5dfdc8d12f46133b81
parentda3cfcdd197bd900633c563412685315316804f4 (diff)
Log errors when failing to make authentication dirs/files
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--auth.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/auth.c b/auth.c
index dc372a0..a2cd9d6 100644
--- a/auth.c
+++ b/auth.c
@@ -312,8 +312,16 @@ MakeServerAuthFile (struct display *d, FILE ** file)
if ((statb.st_mode & 0077) != 0)
(void) chmod(d->authFile, statb.st_mode & 0700);
} else {
- if (errno == ENOENT)
+ if (errno == ENOENT) {
r = mkdir(d->authFile, 0700);
+ if (r < 0) {
+ LogError ("cannot make authentication directory %s: "
+ "%s\n", d->authFile, _SysErrorMsg (errno));
+ }
+ } else {
+ LogError ("cannot access authentication directory %s: "
+ "%s\n", d->authFile, _SysErrorMsg (errno));
+ }
if (r < 0) {
free (d->authFile);
d->authFile = NULL;
@@ -324,6 +332,8 @@ MakeServerAuthFile (struct display *d, FILE ** file)
authDir, authdir1, authdir2);
r = mkdir(d->authFile, 0700);
if (r < 0 && errno != EEXIST) {
+ LogError ("cannot make authentication directory %s: %s\n",
+ d->authFile, _SysErrorMsg (errno));
free (d->authFile);
d->authFile = NULL;
return FALSE;
@@ -333,6 +343,8 @@ MakeServerAuthFile (struct display *d, FILE ** file)
#ifdef HAS_MKSTEMP
fd = mkstemp (d->authFile);
if (fd < 0) {
+ LogError ("cannot make authentication file %s: %s\n",
+ d->authFile, _SysErrorMsg (errno));
free (d->authFile);
d->authFile = NULL;
return FALSE;