[net.news.b] 2.10 and 2.10.1 expire bugs

bukys@rochester.UUCP (Liudvikas Bukys) (10/14/83)

mkparents() in expire.c should return a value.  Since the garbage value it
ends up returning is usually or always non-zero, the first article expired
after a mkdir is lost.

So change the first "return" to a "return (0)", and put a "return (rc);" at the end.  Or replace mkparents in expire.c with the following fixed version...

	NOTE 1:	Do not confuse this with mkparents in inews.c, which is not
		expected to return a value, and works better on USG systems,
		I'll bet.

	NOTE 2:	I fixed the 2.10 version before I looked at the 2.10.1 version,
		so I ended up fixing a previous bug slightly differently:
		The code was confused about what was in "buf" and "sysbuf".
		The 2.10.1 code fixed it by inserting a "strcpy(sysbuf,buf);"
		in a handy place (ugh).  I fixed it by having the printf,
		chmod and chown use "buf" as they should have.

-------
int mkparents(dirname)
char *dirname;
{
	char buf[200], sysbuf[200];
	register char *p;
	int rc;
	struct passwd *pw;

	strcpy(buf, dirname);
	p = rindex(buf, '/');
	if (p)
		*p = '\0';
	if (exists(buf))
		return (0);
	mkparents(buf);
	sprintf(sysbuf, "mkdir %s", buf);
	rc = system(sysbuf);
	if (verbose)
		printf("mkdir %s, rc %d\n", buf, rc);
	chmod(buf, 0755);
	if ((pw = getpwnam(NEWSU)) != NULL)
		chown(buf, pw->pw_uid, pw->pw_gid);
	return rc;
}
-------

Liudvikas Bukys
rochester!bukys (uucp)
bukys@rochester (arpa)