I have ed-0.2-r5 installed on my Gentoo and if I try to run ed, it fails to start with "/tmp/ed.kyBTZg: Bad file descriptor" error. Reproducible: Always Steps to Reproduce: 1.emerge =sys-apps/ed-0.2-r5 2.run ed Actual Results: "Bad file descriptor" error. Expected Results: Start ed IMHO the problem is in 0.2-mkstemp.patch file, where is the code: sfd = mkstemp(sfn); if ((sfd == -1) || (sfp = fdopen (sfn, "w+")) == NULL) but there should be if ((sfd == -1) && (sfp = fdopen (sfn, "w+")) == NULL) The fdopen should be run only if the mkstemp fails. But in present version it's called everytime and it fails, because mkstemp opens file with O_EXCL flag which means no one other can open the file.
indeed
no, that's not how fdopen() works the problem is that the parameter to fdopen is still wrong, it should be sfd fixed in 0.2-r6
*** Bug 77351 has been marked as a duplicate of this bug. ***
*** Bug 77383 has been marked as a duplicate of this bug. ***
*** Bug 77393 has been marked as a duplicate of this bug. ***
*** Bug 78120 has been marked as a duplicate of this bug. ***