[1493] in testers

home help back first fref pref prev next nref lref last post

Bug fix for xcluster.

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Wed Dec 19 09:31:06 1990

From: vanharen@ATHENA.MIT.EDU
Date: Wed, 19 Dec 90 09:30:34 -0500
To: testers@ATHENA.MIT.EDU

It has been reported that xcluster does not die if killed with
XKillClient (via twm or xkill).  The following patch fixes that.  I've
also included a fix to the makefile, so that the bitmaps are installed
with the correct mode, and so that the manpages and object destinations
are fully specified.  It also does not attempt to make /usr/athena/lib
anymore, since it does not use it.  However, this is not a big problem
since it exists anyway.  Please either apply these patches or pick up
the files  /mit/xmit/Xcluster/src/{main.c,Makefile}

					Thanks,
					 -C.


diff -cr /source/athena/usr.athena/xcluster/Makefile ./Makefile
*** /source/athena/usr.athena/xcluster/Makefile	Tue Nov 20 16:26:22 1990
--- ./Makefile	Wed Dec 19 09:24:07 1990
***************
*** 40,54 ****
  	$(RM) $(ALL) a.out *.o core *~ *.bak tags TAGS
  
  install: $(XTARGET)
! 	-mkdir $(DESTDIR)/usr
! 	-mkdir $(DESTDIR)/usr/athena
! 	-mkdir $(DESTDIR)/usr/athena/lib
! 	$(INSTALL) $(XTARGET).map $(DESTDIR)/usr/lib/X11/bitmaps/mitmap
! 	$(INSTALL) $(XTARGET).owl $(DESTDIR)/usr/lib/X11/bitmaps/owl
! 	$(INSTALL) -s $(XTARGET) $(DESTDIR)/usr/athena
! 	$(INSTALL) -s $(TARGET) $(DESTDIR)/usr/athena
! 	$(INSTALL) -m 0444 $(XTARGET).1 $(DESTDIR)/usr/man/man1
! 	$(INSTALL) -m 0444 $(TARGET).1 $(DESTDIR)/usr/man/man1
  
  tags:
  	ctags -tdw *.c *.h
--- 40,51 ----
  	$(RM) $(ALL) a.out *.o core *~ *.bak tags TAGS
  
  install: $(XTARGET)
! 	$(INSTALL) -m 0444 $(XTARGET).map $(DESTDIR)/usr/lib/X11/bitmaps/mitmap
! 	$(INSTALL) -m 0444 $(XTARGET).owl $(DESTDIR)/usr/lib/X11/bitmaps/owl
! 	$(INSTALL) -s $(XTARGET) $(DESTDIR)/usr/athena/$(XTARGET)
! 	$(INSTALL) -s $(TARGET) $(DESTDIR)/usr/athena/$(TARGET)
! 	$(INSTALL) -m 0444 $(XTARGET).1 $(DESTDIR)/usr/man/man1/$(XTARGET).1 
! 	$(INSTALL) -m 0444 $(TARGET).1 $(DESTDIR)/usr/man/man1/$(TARGET).1 
  
  tags:
  	ctags -tdw *.c *.h
diff -cr /source/athena/usr.athena/xcluster/main.c ./main.c
*** /source/athena/usr.athena/xcluster/main.c	Tue Nov 20 16:22:19 1990
--- ./main.c	Mon Dec 17 15:20:03 1990
***************
*** 8,13 ****
--- 8,14 ----
  #include "xcluster.h"		/* global include file. */
  #include <sys/signal.h>		/* signal handling functions */
  #include <sys/types.h>
+ #include <sys/ioctl.h>
  
  /*
   * GLOBAL VARIABLES
***************
*** 28,33 ****
--- 29,35 ----
  
    fd_set readfds, allfds;
    int xfd, numfds;
+   int bytes = 0;
  
    progname = rindex(argv[0], '/');
    if(progname == (char *) NULL)
***************
*** 67,72 ****
--- 69,90 ----
  
    while(1)
      {
+       if (bytes && !XPending(display))
+ 	{
+ 	  /*
+ 	   * If bytes is non-zero, and there are no events pending, then
+ 	   * the socket may have been terminated.  We check with ioctl.
+ 	   * If ioctl reports 0 bytes waiting, then the socket is
+ 	   * broken, and we exit.
+ 	   */
+ 	  (void) ioctl(ConnectionNumber(display), FIONREAD, &bytes);
+ 	  if (!bytes)
+ 	    {
+ 	      fprintf(stderr, "%s: Connection broken, exiting.\n", progname);
+ 	      exit(-1);
+ 	    }
+ 	}
+ 
        while (XPending(display)) /* Got an X Event to deal with? */
  	{
  	  XNextEvent(display, &event);
***************
*** 100,107 ****
  	}
  
        readfds = allfds;
!       (void) select(numfds, &readfds,
! 		    (fd_set *) 0, (fd_set *) 0, (struct timeval *) 0);
      }
  }
  
--- 118,134 ----
  	}
  
        readfds = allfds;
!       switch(select(numfds, &readfds,
! 		    (fd_set *) 0, (fd_set *) 0, (struct timeval *) 0))
! 	{
! 	case -1:
! 	  fprintf(stderr, "%s: error -1 returned from select.\n", progname);
! 	  exit(-1);
! 
! 	default:		/* something must be pending */
! 	  bytes = 1;
! 	  break;
! 	}
      }
  }
  

home help back first fref pref prev next nref lref last post