unshar

Steve Peltz peltz at cerl.uiuc.edu
Sat Jan 6 10:00:23 AEST 1990


I never got any response on my question regarding a bug I found in unshar (my
patchlevel is 0, v2.0, I don't know if there are any patches out to the shar
package), so I guess I'll just post my fix and be done with it.

The problem is with specifying the -d (or -c) flag; it is supposed to create the
directory if it doesn't already exist, but if it does have to create it, it
fails to switch to it.


*** unshar.c.orig	Fri Nov  3 16:41:43 1989
--- unshar.c	Fri Nov  3 16:45:00 1989
***************
*** 334,340 ****
  	}
  
  	/* Got directory; try to go there.  Only make last component. */
! 	if (chdir(p) < 0 && mkdir(p, 0777) < 0 && chdir(p) < 0)
  	    Quit("Cannot chdir nor mkdir desired directory");
      }
      else
--- 334,340 ----
  	}
  
  	/* Got directory; try to go there.  Only make last component. */
! 	if (chdir(p) < 0 && (mkdir(p, 0777) < 0 || chdir(p) < 0))
  	    Quit("Cannot chdir nor mkdir desired directory");
      }
      else
--
Steve Peltz (almost) CFI-G
"Monticello traffic, Glider 949 landing 18, full stop"



More information about the Comp.sources.bugs mailing list