[comp.windows.x] X.V11R3 local network problem

svenole@EIK.II.UIB.NO (Sven-Ole Skrivervik) (04/11/89)

Hello out there.

  I have some problems with release 3 that I did not have with release 2.
I can`t display applications through the network with this installation. I
just get segmentation fault when I try to start an application on one 
machin and display it on another. Everything is ok when I run applications
on the machin where the server is running. Do any of you out there have some 
info about what might be wrong here????? The release is installed on a 
sun 3/280 with OS 3.4 and it is a fileserver for several 3/60's and 3/50's.


		Thank you!

		Sven Ole Skrivervik

devin@lucid.com (Matthieu Devin) (04/15/89)

In article <24794.8904111227@eik.II.UIB.NO>, svenole@EIK.II.UIB.NO (Sven-Ole Skrivervik) writes:
>   I have some problems with release 3 that I did not have with release 2.
> I can`t display applications through the network with this installation. I
> just get segmentation fault when I try to start an application on one 

I had the same problems with release 3.2 of Sun OS.  

It comes from the fact that some times (but not always..) malloc(0) returns a
NULL pointer.

Both Xlib, in _XConnectDisplay when allocating visuals, and Xt when overriding
translation tables, suppose that malloc(0) returning NULL means there is no
more memory available. 
   Q: How much memory do you need to allocate no space :-)

You can overrid that by defing the flag MALLOC_0_RETURNS_NULL in Sun.macros,
(and make Makefiles, etc..).

There is no such flag for Xt so you much edit Alloc.c to test if arguments
are 0 and change them to 1..
Here is a context diff 

*** Alloc.c	Wed Apr 12 08:49:42 1989
--- RCS/Alloc.c	Fri Apr 10 17:14:56 1989
***************
*** 41,49 ****
      unsigned size;
  {
      char *ptr;
- #ifdef sun
-     if(size == 0) size = 1;
- #endif
      if ((ptr = malloc(size)) == NULL)
          XtErrorMsg("allocError","malloc","XtToolkitError",
                   "Cannot perform malloc", (String *)NULL, (Cardinal *)NULL);
--- 41,46 ----
***************
*** 54,62 ****
      char     *ptr;
      unsigned size;
  {
- #ifdef sun
-     if(size == 0) size = 1;
- #endif
     if (ptr == NULL) return(XtMalloc(size));
     else if ((ptr = realloc(ptr, size)) == NULL)
              XtErrorMsg("allocError","realloc","XtToolkitError",
--- 51,56 ----
***************
*** 68,77 ****
      unsigned num, size;
  {
      char *ptr;
- #ifdef sun
-     if(size == 0) size = 1;
-     if(num == 0) num = 1;
- #endif
      if ((ptr = calloc(num, size)) == NULL) 
           XtErrorMsg("allocError","calloc","XtToolkitError",
                  "Cannot perform calloc", (String *)NULL, (Cardinal *)NULL);
--- 62,67 ----



-- 
Matthieu Devin               Lucid Inc, 707 Laurel Street, Menlo Park, CA 94025
devin@lucid.com              (415)329-8400 x 5574