[net.bugs.4bsd] minor bug in 4.2 uucp

jeff@voder.UUCP (Jeff Gilliam) (08/11/85)

Index:	uucp/mailst.c 4.2BSD

Description:
	When uucp sends mail to a user to indicate a problem, it sometimes
	sends an empty message.
Repeat-By:
	Get another site to execute 'uux yoursite!login'.  Uuxqt will try
	to send a message indicating that the uuxqt was denied.  If your
	uucp has the problem the remote site will receive and empty message.
Fix:
	In mailst() a pipe is opened to the mail command and a status
	message written to the pipe.  Unfortunately, mailst() fails to
	ensure that the message is terminated by a newline.  The
	following diff both corrects the problem and changes the format
	of the mail to match the 4.3 uucp.

	diff -c -r1.1 -r1.2
	*** /tmp/,RCSt1007993	Sat Aug 10 21:24:12 1985
	--- /tmp/,RCSt2007993	Sat Aug 10 21:24:13 1985
	***************
	*** 23,29
		sprintf(cmd, "mail %s", user);
		if ((fp = rpopen(cmd, "w")) == NULL)
			return;
	! 	fprintf(fp, "%s", str);
	  
		if (*file != '\0' && (fi = fopen(subfile(file), "r")) != NULL) {
			while ((nc = fread(buf, sizeof (char), BUFSIZ, fi)) > 0)

	--- 23,30 -----
		sprintf(cmd, "mail %s", user);
		if ((fp = rpopen(cmd, "w")) == NULL)
			return;
	! 	fprintf(fp, "To: %s\n", user);
	! 	fprintf(fp, "Subject: %s\n", str);
	  
		if (*file != '\0' && (fi = fopen(subfile(file), "r")) != NULL) {
			while ((nc = fread(buf, sizeof (char), BUFSIZ, fi)) > 0)

-- 

Jeff Gilliam	{ucbvax,ihnp4!nsc}!voder!jeff