Bug 73479 - paplay incorrectly assumes stdin will be open
Summary: paplay incorrectly assumes stdin will be open
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: tools (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: lowest normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-10 16:45 UTC by Simon Gomizelj
Modified: 2018-07-30 09:36 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Simon Gomizelj 2014-01-10 16:45:02 UTC
I ran into this issue after debuging why paplay wouldn't work in a script called by another program. It looks like this program closes stdin/stdout/stderr before running the script. This causes this to happen:

open("foo.wav", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 0
fcntl(0, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
dup2(0, 0)                              = 0
close(0)                                = 0
fstat(0, 0x7fffaa2ce740)                = -1 EBADF (Bad file descriptor)

Open returns 0, as it should, in this case. However the assumption that stdin is still present causes the dup2/close syscalls to close the filedescriptor we've just opened and not stdin as intended. This causes paplay to die with a EBADF error.
Comment 1 GitLab Migration User 2018-07-30 09:36:02 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/43.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.