fprintf() weirdness?

Mark W. Eichin eichin at athena.mit.edu
Thu Dec 15 10:28:52 AEST 1988


Strange problem: I have a mail-fetch program which uses authenticated
POP to talk to a mail server and retrieve mail. It uses an SMTP-like
protocol, ie. commands are text with \r\n at the end of each line.

It runs perfectly on the VAX and IBM PC/RT under 4.3BSD. When I
compile it under A/UX and run it, I get a core dump in the first

	fprintf(f, "%s\r\n", buf);

where f=fdopen(s, "r") earlier (and is not NULL...) The catch: If I
change the fprintf to a

	fputs(buf,f); fputs("\r\n",f);

it works. The core dump in fprintf (according to adb) is the result of
calling bcopy(0,buf,0xB) which appears to be from the FILE structure
remaining uninitialized. As I said, it works perfectly under 4.3, and
the code gives no warnings under Saber (a C interpreter which catches
far more than lint does, specfically bounds checks.) Any suggestions
as to what these symptoms might be? Not having source (insert standard
FLAME here) makes it hard to debug fprintf. I suspect there is some
SysV idiom I am missing here, though.

				Mark Eichin
			<eichin at athena.mit.edu>
		SIPB Member & Project Athena ``Watchmaker'' 



More information about the Comp.unix.aux mailing list