The attached patch fixes a bug where xauth may write an
incomplete .xauth file and delete the old one if there is
insufficient disk space.  The patch applies cleanly to CVS head, 
xf-4_2-branch, and xf-4_1-branch and is tested.

Please credit:  Harald Hoyer <[EMAIL PROTECTED]>


-- 
Mike A. Harris     ftp://people.redhat.com/mharris
OS Systems Engineer - XFree86 maintainer - Red Hat
--- xc/programs/xauth/process.c.xauth-diskfull  2003-02-11 06:52:26.000000000 -0500
+++ xc/programs/xauth/process.c 2003-02-11 06:55:02.000000000 -0500
@@ -809,14 +809,20 @@
        if (list->auth->name_length == 18
            && strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) == 0)
        {
-           XauWriteAuth (fp, list->auth);
+         if(!XauWriteAuth (fp, list->auth)) {
+           (void) fclose (fp);     
+           return -1;
+         }
        }
     }
     for (list = xauth_head; list; list = list->next) {
        if (list->auth->name_length != 18
            || strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) != 0)
        {
-           XauWriteAuth (fp, list->auth);
+         if(!XauWriteAuth (fp, list->auth)) {
+           (void) fclose (fp);
+           return -1;
+         }
        }
     }
 

Reply via email to