[comp.os.minix] Official Clam Patch #2a

wtoomey@gara.une.oz (Warren Toomey) (06/07/89)

	I finally found the bug that was causing Clam to crash, and
Jwahar Bammi found it at the same time :-)

	So here are the patches to get Clam Patch #2 to work.
Builtin.c has been modified; it had the bug in it. Header.h & main.c
have also changed, as they didn't work too well on the Atari.
Thanks Jwahar!

	Let me know if there are any more problems.

						Warren Toomey
						(wtoomey@gara.une.oz)
------------------------------- shred here ----------------------------

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# builtin.cdif header.hdif main.cdif

echo x - builtin.cdif
cat > "builtin.cdif" << '//E*O*F builtin.cdif//'
*** 2builtin.c	Wed Jun  7 09:59:21 1989
--- builtin.c	Wed Jun  7 09:57:14 1989
***************
*** 34,39 ****
--- 34,42 ----
    extern char *getcwd();
  #endif
  
+ #ifdef DEBUG
+ fprintf(stderr,"In Cd\n");
+ #endif
    if (argc==1) argv[1]=vget("HOME");
    if (argc>2)
    {
***************
*** 48,54 ****
    else argv[1]=(char *) malloc ((unsigned)(MAXPL));
  #endif
  #ifdef ATT
!   if (getcwd(argv[1]),MAXPL) vset("cwd",argv[1]);
  #else
  # ifdef MINIX
    if (getcwd(dirname, 128)) vset("cwd",dirname);
--- 51,57 ----
    else argv[1]=(char *) malloc ((unsigned)(MAXPL));
  #endif
  #ifdef ATT
!   if (getcwd(argv[1],MAXPL)) vset("cwd",argv[1]);
  #else
  # ifdef MINIX
    if (getcwd(dirname, 128)) vset("cwd",dirname);
***************
*** 57,63 ****
  # endif
  #endif
    else write(2,"Can't get cwd properly\n",23);
!   free(argv[1]);	/* just in case? */
  }
  
  static
--- 60,69 ----
  # endif
  #endif
    else write(2,"Can't get cwd properly\n",23);
!   /* free(argv[1]);	 just in case? */
! #ifdef DEBUG
! fprintf(stderr,"Leaving Cd\n");
! #endif
  }
  
  static
//E*O*F builtin.cdif//

echo x - header.hdif
cat > "header.hdif" << '//E*O*F header.hdif//'
*** /tmp/,RCSt1a00566	Sun Jun  4 17:42:37 1989
--- header.h	Sat Jun  3 17:05:34 1989
***************
*** 9,16 ****
  #  include <sys/file.h>
  #else
  #  include <sgtty.h>
- #  include <sys/dir.h>
  #  ifndef ATARI_ST
  #    include <sys/time.h>
  #else
  #    include <time.h>
--- 9,16 ----
  #  include <sys/file.h>
  #else
  #  include <sgtty.h>
  #  ifndef ATARI_ST
+ #    include <sys/dir.h>
  #    include <sys/time.h>
  #else
  #    include <time.h>
***************
*** 228,234 ****
  void goend(char *, int *, int *);
  void copyback(char *, int, int *, int);
  void delnextword(char *, int, int *);
! void delprevword(char *, int, int *);
  void backword(char *, int *, int *);
  void forword(char *, int *, int *);
  void yanknext(char *, int, char *);
--- 228,234 ----
  void goend(char *, int *, int *);
  void copyback(char *, int, int *, int);
  void delnextword(char *, int, int *);
! void delprevword(char *, int *, int *);
  void backword(char *, int *, int *);
  void forword(char *, int *, int *);
  void yanknext(char *, int, char *);
//E*O*F header.hdif//

echo x - main.cdif
cat > "main.cdif" << '//E*O*F main.cdif//'
*** main.c~	Sat Jun  3 16:01:40 1989
--- main.c	Sat Jun  3 19:41:01 1989
***************
*** 424,429 ****
--- 424,430 ----
    termod->sg_flags |= ECHO;		/* echo chars to screen */
    if (ioctl(0,TIOCSETP,termod))		/* put it back, modified */
      perror("ioctl");
+   free(termod);
    setsigc=(struct tchars *) malloc ((unsigned)(sizeof(struct tchars)));
    if (ioctl(0,TIOCGETC,setsigc))	/* get the tchars struct */
      perror("ioctl");
***************
*** 432,437 ****
--- 433,439 ----
    setsigc->t_eofc=4;			/* and eof signalling */
    if (ioctl(0,TIOCSETC,setsigc))	/* put it back, modified */
      perror("ioctl");
+   free(setsigc);
  # ifndef MINIX
    moresigc.t_suspc=26;			/* stopping */
    moresigc.t_dsuspc=25;		/* delayed stopping */
//E*O*F main.cdif//

exit 0