summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@users.sourceforge.net>2005-06-21 09:59:49 +0000
committerBastien Nocera <hadess@users.sourceforge.net>2005-06-21 09:59:49 +0000
commitca7f6b0509afe39283168d850daf061db4f01d55 (patch)
tree479bd60b5ecfbb41ea1db9ca1f44375cc97a528f
parent6e8ed54d14664895e16b77c9e8da60d53417696a (diff)
downloadxine-lib-ca7f6b0509afe39283168d850daf061db4f01d55.tar.gz
xine-lib-ca7f6b0509afe39283168d850daf061db4f01d55.tar.bz2
- Patch from Christophe Thommeret <hftom@free.fr> to avoid checking
for the size of a FIFO Fix a file descriptor leak when the length of a file is zero CVS patchset: 7632 CVS date: 2005/06/21 09:59:49
-rw-r--r--src/input/input_file.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/input/input_file.c b/src/input/input_file.c
index f3c4284f2..90efb46dc 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_file.c,v 1.101 2005/05/29 12:29:42 hadess Exp $
+ * $Id: input_file.c,v 1.102 2005/06/21 09:59:49 hadess Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -241,6 +241,7 @@ static char *decode_uri (char *uri) {
static int file_plugin_open (input_plugin_t *this_gen ) {
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
char *filename;
+ struct stat sbuf;
lprintf("file_plugin_open\n");
@@ -274,7 +275,7 @@ static int file_plugin_open (input_plugin_t *this_gen ) {
}
else
this->fh = open(this->mrl, O_RDONLY|O_BINARY);
-
+
if (this->fh == -1) {
if (errno == EACCES) {
_x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL);
@@ -290,8 +291,15 @@ static int file_plugin_open (input_plugin_t *this_gen ) {
}
}
+ /* don't check length of fifo */
+ if (fstat (this->fh, &sbuf) == 0) {
+ if (S_ISFIFO(sbuf.st_mode))
+ return 1;
+ }
+
if (file_plugin_get_length (this_gen) == 0) {
_x_message(this->stream, XINE_MSG_FILE_EMPTY, this->mrl, NULL);
+ close (this->fh);
xine_log (this->stream->xine, XINE_LOG_MSG,
_("input_file: File empty: >%s<\n"), this->mrl);
return 0;