mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-09-15 04:08:07 -04:00
Fix the dang file descriptor leak of < 0.4.1 for good; the old fix only
took care of it partially. Diagnosed with the help from someone, who wishes to stay anonymous. Thanks! git-svn-id: https://svn.xiph.org/trunk/ezstream@13296 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
parent
07e82c01a4
commit
ef221fcc38
@ -570,7 +570,7 @@ openResource(shout_t *shout, const char *fileName, int *popenFlag,
|
||||
|
||||
*popenFlag = 0;
|
||||
if (pezConfig->reencode) {
|
||||
int stderr_fd = dup(fileno(stderr));
|
||||
int stderr_fd = -1;
|
||||
|
||||
pCommandString = buildCommandString(extension, fileName, mdata);
|
||||
metadata_free(&mdata);
|
||||
@ -581,6 +581,7 @@ openResource(shout_t *shout, const char *fileName, int *popenFlag,
|
||||
if (qFlag) {
|
||||
int fd;
|
||||
|
||||
stderr_fd = dup(fileno(stderr));
|
||||
if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1) {
|
||||
printf("%s: Cannot open %s for redirecting STDERR output: %s\n",
|
||||
__progname, _PATH_DEVNULL, strerror(errno));
|
||||
@ -610,11 +611,11 @@ openResource(shout_t *shout, const char *fileName, int *popenFlag,
|
||||
}
|
||||
xfree(pCommandString);
|
||||
|
||||
if (qFlag) {
|
||||
if (qFlag)
|
||||
dup2(stderr_fd, fileno(stderr));
|
||||
if (stderr_fd > 2)
|
||||
close(stderr_fd);
|
||||
}
|
||||
|
||||
if (stderr_fd > 2)
|
||||
close(stderr_fd);
|
||||
|
||||
return (filep);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user