Subject: Re: (fwd) Re: Unoff4 -- Now this is strange.
From: [email-masked] (Jerry Aguirre)
To: [email-masked], [email-masked]
Date: Thu, 21 Mar 1996 11:02:22 -0800

The code in crosspost was largly lifted from overchan and innd.  When
the first attempt to create a link fails it calls MakeSpoolDir().
Unfortunately the two pieces of code didn't mesh well.

This patch should correct the problem:

*** backends/crosspost.c.bak	Tue Feb  6 11:18:28 1996
--- backends/crosspost.c	Thu Mar 21 10:57:58 1996
***************
*** 51,58 ****

  /*
! **  Make spool directory.  Return 0 if ok,
! **  else -1.
  */
  STATIC BOOL
  MakeSpoolDir(Name)
--- 51,57 ----

  /*
! **  Make spool directory.  Return FALSE on error.
  */
  STATIC BOOL
  MakeSpoolDir(Name)
***************
*** 61,69 ****
      register char	*p;
      BOOL		made;
  
-     if (InSpoolDir)
- 	return FALSE;
- 
      /* Optimize common case -- parent almost always exists. */
      if (MakeDir(Name))
  	return TRUE;
--- 60,65 ----
***************
*** 140,151 ****
  		for (j--; (j > 0) && (path[j] != '/'); j--) ;
  		if (path[j] == '/') {
  		    path[j] = '\0';
! 		    if (MakeSpoolDir(path)) { /* try making parent dir */
  			(void)fprintf(stderr, "crosspost cant mkdir %s\n",
  				path);
  		    }
  		    else {
! 			if (link(names[0], names[i]) < 0) { /* 2nd try to link */
  #if	defined(DONT_HAVE_SYMLINK)
  			    (void)fprintf(stderr, "crosspost cant link %s %s",
  				names[0], names[i]);
--- 136,149 ----
  		for (j--; (j > 0) && (path[j] != '/'); j--) ;
  		if (path[j] == '/') {
  		    path[j] = '\0';
! 		    /* try making parent dir */
! 		    if (MakeSpoolDir(path) == FALSE) {
  			(void)fprintf(stderr, "crosspost cant mkdir %s\n",
  				path);
  		    }
  		    else {
! 			/* 2nd try to link */
! 			if (link(names[0], names[i]) < 0) {
  #if	defined(DONT_HAVE_SYMLINK)
  			    (void)fprintf(stderr, "crosspost cant link %s %s",
  				names[0], names[i]);