mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed calling close(-1) in cUnbufferedFile::Close()
This commit is contained in:
parent
3de4811a42
commit
81cc592c33
@ -1218,6 +1218,7 @@ Reinhard Nissl <rnissl@gmx.de>
|
|||||||
for reporting a typo in aspect ratio 2.21:1
|
for reporting a typo in aspect ratio 2.21:1
|
||||||
for reporting a problem in case the PIDs change during recording
|
for reporting a problem in case the PIDs change during recording
|
||||||
for reporting a memory leak when reaching the end of a recording during replay
|
for reporting a memory leak when reaching the end of a recording during replay
|
||||||
|
for reporting a call to close(-1) in cUnbufferedFile::Close()
|
||||||
|
|
||||||
Richard Robson <richard_robson@beeb.net>
|
Richard Robson <richard_robson@beeb.net>
|
||||||
for reporting freezing replay if a timer starts while in Transfer Mode from the
|
for reporting freezing replay if a timer starts while in Transfer Mode from the
|
||||||
|
1
HISTORY
1
HISTORY
@ -6114,3 +6114,4 @@ Video Disk Recorder Revision History
|
|||||||
- Updated the Ukrainian OSD texts (thanks to Yarema Aka Knedlyk).
|
- Updated the Ukrainian OSD texts (thanks to Yarema Aka Knedlyk).
|
||||||
- Fixed a memory leak when reaching the end of a recording during replay (reported
|
- Fixed a memory leak when reaching the end of a recording during replay (reported
|
||||||
by Reinhard Nissl).
|
by Reinhard Nissl).
|
||||||
|
- Fixed calling close(-1) in cUnbufferedFile::Close() (reported by Reinhard Nissl).
|
||||||
|
14
tools.c
14
tools.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: tools.c 2.2 2009/01/16 14:29:08 kls Exp $
|
* $Id: tools.c 2.3 2009/05/31 11:43:24 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
@ -1473,16 +1473,18 @@ int cUnbufferedFile::Open(const char *FileName, int Flags, mode_t Mode)
|
|||||||
|
|
||||||
int cUnbufferedFile::Close(void)
|
int cUnbufferedFile::Close(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_FADVISE
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
|
#ifdef USE_FADVISE
|
||||||
if (totwritten) // if we wrote anything make sure the data has hit the disk before
|
if (totwritten) // if we wrote anything make sure the data has hit the disk before
|
||||||
fdatasync(fd); // calling fadvise, as this is our last chance to un-cache it.
|
fdatasync(fd); // calling fadvise, as this is our last chance to un-cache it.
|
||||||
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
|
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
int OldFd = fd;
|
int OldFd = fd;
|
||||||
fd = -1;
|
fd = -1;
|
||||||
return close(OldFd);
|
return close(OldFd);
|
||||||
|
}
|
||||||
|
errno = EBADF;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When replaying and going e.g. FF->PLAY the position jumps back 2..8M
|
// When replaying and going e.g. FF->PLAY the position jumps back 2..8M
|
||||||
|
Loading…
Reference in New Issue
Block a user