From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Date: Mon, 29 Oct 2007 10:10:30 +0000 From: "Douglas A. Gwyn" Message-ID: <4723108A.2FC11F49@null.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <56091BE8-6F06-45B8-AB4F-075051F4B57D@mac.com> Subject: Re: [9fans] grap retarded?? Topicbox-Message-UUID: ddb4af92-ead2-11e9-9d60-3106f5b1d025 I found another bug, in Plan 9 "grap" source file print.c, function "opentemp": if tfd is not NULL and also not stdout, it gets fclose()d twice. I don't know whether that happens to be benign on the Plan 9 implementation, but it can cause problems when ported to other platforms. Also in the same file, in the "print" function, if tfd is stdout then stdout is fclose()d but later continues to be used. I'm not sure of the intent of this change from an earlier version of "grap"; however, I suggest the following patches to src/grap/print.c: In print(), change the test to if (tfd != stdout) { if (tfd != NULL) fclose(tfd); /* end the temp file */ tfd = stdout; } In opentemp(), delete the first occurrence of if (tfd != NULL) fclose(tfd);