Mercurial > mplayer.hg
changeset 36152:c3b4a1b48c7d
Make 0 termination code more robust against future changes.
author | reimar |
---|---|
date | Tue, 07 May 2013 20:39:17 +0000 |
parents | 63bc09af21f4 |
children | affa86541a51 |
files | input/input.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/input/input.c Tue May 07 20:39:16 2013 +0000 +++ b/input/input.c Tue May 07 20:39:17 2013 +0000 @@ -1608,6 +1608,8 @@ int bs = strlen(buffer); if(! eof && bs < BS_MAX-1) { int r = read(fd,buffer+bs,BS_MAX-1-bs); + if (r > 0) bs += r; + buffer[bs] = 0; if(r < 0) { if(errno == EINTR) continue; @@ -1616,8 +1618,6 @@ return 0; } eof = r == 0; - bs += r; - buffer[bs] = 0; } // Empty buffer : return if(!buffer[0]) {