Red Hat Bugzilla – Bug 427335
Bug patch #44798 replaces "dangerous" code with "malfunctioning" code
Last modified: 2008-01-04 05:09:51 EST
Description of problem:
Patch mailx-8.1.1-bug44798.patch which was accepted without testing in 2004
turned working code into malfunctioning code. But at least the compiler warning
about "dangerous" code disappeared!
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. read mailx-8.1.1-bug44798.patch
mail file not correctly edited
mail file should be correctly edited
The patch introduced the following:
tempfd = mkstemp(tempname);
obuf = Fopen(tempname, "w")
but the Fopen will always fail because mkstemp() just created the file!
So remainder of edstop() function never executes.
Obviously the patch should have replaced Fopen(tempname,..) with Fdopen(tempfd,...).
It has taken 3 years for anybody to detect this glaring error in this obviously
untested patch. That should be worth something. At least the compiler doesn't
generate error message about possibly "dangerous" code any more. Pity it doesn't
emit error messages about possible "malfunctioning" code.
Thanks for your bug report. Fopen(tempname,..) command is right there (see man
3p fopen) problems are: open file descriptor tempfd which is not closed here and
mkstemp command outuput is not tested here - fixed in mailx-8.1.1-47.fc9.