xserver: Branch 'master' - 2 commits

Alan Coopersmith alanc at kemper.freedesktop.org
Mon Nov 24 20:35:05 PST 2008


 hw/xfree86/common/xf86Configure.c        |   41 ++++++++++++++-----------------
 hw/xfree86/os-support/solaris/sun_init.c |   14 +++++++---
 2 files changed, 29 insertions(+), 26 deletions(-)

New commits:
commit 5bf2c88d2317230b95b2904cb975167d03ee13a2
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Nov 24 20:34:46 2008 -0800

    Simplify filename generation code for Xorg -configure

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 6680a61..7778060 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -662,12 +662,17 @@ configureDDCMonitorSection (int screennum)
     return ptr;
 }
 
+#if !defined(PATH_MAX)
+# define PATH_MAX 1024
+#endif
+
 void
-DoConfigure()
+DoConfigure(void)
 {
     int i,j, screennum = -1;
     char *home = NULL;
-    char *filename = NULL;
+    char filename[PATH_MAX];
+    char *addslash = "";
     XF86ConfigPtr xf86config = NULL;
     char **vlist, **vl;
     int *dev2screen;
@@ -765,29 +770,21 @@ DoConfigure()
     xf86config->conf_input_lst = configureInputSection();
     xf86config->conf_layout_lst = configureLayoutSection();
 
-    if (!(home = getenv("HOME")))
+    home = getenv("HOME");
+    if ((home == NULL) || (home[0] = '\0')) {
     	home = "/";
-    {
-#if !defined(PATH_MAX)
-#define PATH_MAX 1024
-#endif
-        const char* configfile = XF86CONFIGFILE".new";
-    	char homebuf[PATH_MAX];
-    	/* getenv might return R/O memory, as with OS/2 */
-    	strncpy(homebuf,home,PATH_MAX-1);
-    	homebuf[PATH_MAX-1] = '\0';
-    	home = homebuf;
-    	if (!(filename =
-	     (char *)xalloc(strlen(home) + 
-	  			 strlen(configfile) + 3)))
-		goto bail;
-
-      	if (home[0] == '/' && home[1] == '\0')
-            home[0] = '\0';
-	sprintf(filename, "%s/%s", home,configfile);
-	
+    } else {
+	/* Determine if trailing slash is present or needed */
+	int l = strlen(home);
+
+	if (home[l-1] != '/') {
+	    addslash = "/";
+	}
     }
 
+    snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
+	     home, addslash);
+
     xf86writeConfigFile(filename, xf86config);
 
     xf86DoConfigurePass1 = FALSE;
commit 75784e1e53ad78e21518696dd9d297bc08c17d54
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Nov 24 20:32:20 2008 -0800

    Solaris: Make KDSETMODE failure non fatal, and retry it on interrupts

diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index b79814d..795b0c1 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -49,8 +49,9 @@ static char fb_dev[PATH_MAX] = "/dev/console";
 void
 xf86OpenConsole(void)
 {
+    int i;
 #ifdef HAS_USL_VTS
-    int fd, i;
+    int fd;
     struct vt_mode VT;
     struct vt_stat vtinfo;
     int FreeVTslot;
@@ -173,9 +174,14 @@ xf86OpenConsole(void)
 	if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
 	    FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
 #endif
+
 #ifdef KDSETMODE
-	if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
-	    FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
+	SYSCALL(i = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
+	if (i < 0) {
+	    xf86Msg(X_WARNING,
+		    "xf86OpenConsole: KDSETMODE KD_GRAPHICS failed on %s (%s)\n",
+		    fb_dev, strerror(errno));
+	}
 #endif
     }
     else /* serverGeneration != 1 */
@@ -257,7 +263,7 @@ xf86CloseConsole(void)
 
 #ifdef KDSETMODE
     /* Reset the display back to text mode */
-    ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
+    SYSCALL(ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
 #endif
 
 #ifdef HAS_USL_VTS


More information about the xorg-commit mailing list