]> git.sesse.net Git - ffmpeg/commitdiff
lavf/libssh: translate a read of 0 to EOF
authorJan Ekström <jeebjp@gmail.com>
Mon, 28 May 2018 00:21:35 +0000 (03:21 +0300)
committerJan Ekström <jeebjp@gmail.com>
Mon, 28 May 2018 17:33:50 +0000 (20:33 +0300)
Yet another case of forgotten 0 =! EOF translation.

While the documentation for this specific synchronous read
function does not mention it, the documentation for
`sftp_async_read` documents it, as well as looking at the
implementation of this function leads one to find
`if (handle->eof) { return 0; }`.

Reported by stnutt on IRC.

libavformat/libssh.c

index 9e3d4da45eff0e471ea1661aa03bee63d232bad5..21474f0f0a59ab95f0f494a50eb28908af67d56b 100644 (file)
@@ -295,7 +295,7 @@ static int libssh_read(URLContext *h, unsigned char *buf, int size)
         av_log(libssh, AV_LOG_ERROR, "Read error.\n");
         return AVERROR(EIO);
     }
-    return bytes_read;
+    return bytes_read ? bytes_read : AVERROR_EOF;
 }
 
 static int libssh_write(URLContext *h, const unsigned char *buf, int size)