From 6c87083685744b6aa899de50128ab74ef8f89982 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 13 Jun 2018 16:14:39 +0200 Subject: [SERVER] Make sure image has read fd before reading --- src/server/integrity.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/server/integrity.c') diff --git a/src/server/integrity.c b/src/server/integrity.c index e07a076..e8124f4 100644 --- a/src/server/integrity.c +++ b/src/server/integrity.c @@ -117,6 +117,12 @@ static void* integrity_main(void * data UNUSED) if ( i + 1 == queueLen ) queueLen--; if ( image == NULL ) continue; // We have the image. Call image_release() some time + // Make sure the image is open for reading (closeUnusedFd) + if ( !image_ensureOpen( image ) ) { + logadd( LOG_MINOR, "Cannot hash check block %d of %s -- no readFd", checkQueue[i].block, image->path ); + image_release( image ); + continue; + } spin_lock( &image->lock ); if ( image->crc32 != NULL && image->realFilesize != 0 ) { int const blocks[2] = { checkQueue[i].block, -1 }; -- cgit v1.2.3-55-g7522