This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XWin.exe crashes


Christopher Faylor wrote:

> I thought your patch only added a "b" to reads and writes which would
> indicate that it needed to operate entirely in "binmode".  However, I
> see that in some cases, it doesn't add the "b".  Not sure why.
> 
> This seems to be the opposite of what you're implying though.

I'm not sure for the other cases. So I just changed the case where the
"wb" was definitly missing.

Fixing bugs at work showed me one thing: Changing not exactly the condition
where the bug occured will likely introduce a new one. If the XFree maintainer 
which applies the patch is sure about the other cases, he can easily add the
"t" where it belongs.

> 
> cgf
> 
> Index: programs/Xserver/xkb/ddxLoad.c
> ===================================================================
> RCS file: /cvs/xc/programs/Xserver/xkb/ddxLoad.c,v
> retrieving revision 3.30
> diff -u -r3.30 ddxLoad.c
> --- programs/Xserver/xkb/ddxLoad.c	2002/05/31 18:46:06	3.30
> +++ programs/Xserver/xkb/ddxLoad.c	2002/11/03 12:29:17
> @@ -413,7 +413,7 @@
>  	else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX)
>  	    sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName);
>  	if (buf[0] != '\0')
> -	    file= fopen(buf,"r");
> +	    file= fopen(buf,"rb");
>  	else file= NULL;
>      }
>      else file= NULL;

This is the server. It reads the binary file. So the "b" should be there. 
The automode maybe fixed this automaticly, but this is the IMHO the better
way.


> Index: programs/xkbcomp/xkbcomp.c
> ===================================================================
> RCS file: /cvs/xc/programs/xkbcomp/xkbcomp.c,v
> retrieving revision 3.17
> diff -u -r3.17 xkbcomp.c
> --- programs/xkbcomp/xkbcomp.c	2002/06/05 00:00:37	3.17
> +++ programs/xkbcomp/xkbcomp.c	2002/11/03 14:57:04
> @@ -873,16 +873,30 @@
>  		 * -- Branden Robinson
>  		 */
>  		int outputFileFd;
> +        int binMode = 0;
> +        const char *openMode = "w";
>  		unlink(outputFile);
> +#ifdef O_BINARY
> +        switch (outputFormat) {
> +            case WANT_XKM_FILE:
> +                binMode = O_BINARY;
> +                openMode = "wb";
> +                break;
> +            default:
> +                binMode = 0;
> +                break;
> +        }
> +#endif
>  		outputFileFd= open(outputFile, O_WRONLY|O_CREAT|O_EXCL,
> -			    S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
> +			    S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH|binMode);
>  		if (outputFileFd<0) {
>  		    ERROR1("Cannot open \"%s\" to write keyboard description\n",
>  								outputFile);
>  		    ACTION("Exiting\n");
>  		    exit(1);
>  		}
> -		out= fdopen(outputFileFd, "w");
> +        
> +		out= fdopen(outputFileFd, openMode);
>  		/* end BR */
>  		if (out==NULL) {
>  		    ERROR1("Cannot open \"%s\" to write keyboard description\n",

This is for xkbcomp. Here the binary file gets written. So I added "wb"
where it was needed and left the other unchanged. 

bye
    ago
-- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]