Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 77367 - Ed crashes on start with "Bad file descriptor"
Summary: Ed crashes on start with "Bad file descriptor"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 77351 77383 77393 78120 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-10 06:10 UTC by Robert Wolf
Modified: 2005-01-15 19:48 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Wolf 2005-01-10 06:10:25 UTC
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.
Comment 1 Carsten Lohrke (RETIRED) gentoo-dev 2005-01-10 06:28:46 UTC
indeed
Comment 2 SpanKY gentoo-dev 2005-01-10 09:10:33 UTC
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
Comment 3 SpanKY gentoo-dev 2005-01-10 10:34:03 UTC
*** Bug 77351 has been marked as a duplicate of this bug. ***
Comment 4 Carsten Lohrke (RETIRED) gentoo-dev 2005-01-10 11:51:07 UTC
*** Bug 77383 has been marked as a duplicate of this bug. ***
Comment 5 Carsten Lohrke (RETIRED) gentoo-dev 2005-01-10 11:56:11 UTC
*** Bug 77393 has been marked as a duplicate of this bug. ***
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-01-15 19:48:29 UTC
*** Bug 78120 has been marked as a duplicate of this bug. ***