From b808b9acc254027fa881c3123ab1b73984e2c1dd Mon Sep 17 00:00:00 2001 From: Ulrich Eckhardt Date: Sun, 21 Feb 2010 20:12:01 +0100 Subject: Avoid invalid fstat calls when opening empty files When opening empty files with xine, it reports: > This is xine (X11 gui) - a free video player v0.99.6cvs. > (c) 2000-2007 The xine Team. > system call fstat: Bad file descriptor > system call fstat: Bad file descriptor > call failed > object not accessible > object not accessible > call failed The problem was that when detecting an empty file, it is closed, but the file descriptor in struct file_input_plugin_t is still left at the previous value, causing the errors when it is used later. --- src/input/input_file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/input/input_file.c b/src/input/input_file.c index 208a5420e..b0da2565d 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -409,6 +409,7 @@ static int file_plugin_open (input_plugin_t *this_gen ) { if (file_plugin_get_length (this_gen) == 0) { _x_message(this->stream, XINE_MSG_FILE_EMPTY, this->mrl, NULL); close (this->fh); + this->fh = -1; xine_log (this->stream->xine, XINE_LOG_MSG, _("input_file: File empty: >%s<\n"), this->mrl); return -1; -- cgit v1.2.3