summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2023-06-30 14:10:25 +0200
committerSimon Rettberg2023-06-30 14:10:25 +0200
commit155d329397f351d0949d05caa4cb83cc2d8119bd (patch)
tree5033b5addc791c6103000028d8294f1efec2689b /src
parent[SERVER] Threadpool: Add active thread count to error message (diff)
downloaddnbd3-155d329397f351d0949d05caa4cb83cc2d8119bd.tar.gz
dnbd3-155d329397f351d0949d05caa4cb83cc2d8119bd.tar.xz
dnbd3-155d329397f351d0949d05caa4cb83cc2d8119bd.zip
[SERVER] Log errno if opening image file fails
Diffstat (limited to 'src')
-rw-r--r--src/server/image.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/image.c b/src/server/image.c
index c62be55..51fd5b6 100644
--- a/src/server/image.c
+++ b/src/server/image.c
@@ -249,7 +249,7 @@ bool image_ensureOpen(dnbd3_image_t *image)
int newFd = image->readFd == -1 ? open( image->path, O_RDONLY ) : dup( image->readFd );
if ( newFd == -1 ) {
if ( !image->problem.read ) {
- logadd( LOG_WARNING, "Cannot open %s for reading", image->path );
+ logadd( LOG_WARNING, "[access] Cannot open '%s' for reading (errno=%d)", image->path, errno );
image->problem.read = true;
}
} else {
@@ -258,7 +258,7 @@ bool image_ensureOpen(dnbd3_image_t *image)
const off_t flen = lseek( newFd, 0, SEEK_END );
if ( flen == -1 ) {
if ( !image->problem.read ) {
- logadd( LOG_WARNING, "Could not seek to end of %s (errno %d)", image->path, errno );
+ logadd( LOG_WARNING, "Could not seek to end of %s (errno=%d)", image->path, errno );
image->problem.read = true;
}
close( newFd );
@@ -826,7 +826,9 @@ static bool image_load(char *base, char *path, bool withUplink)
fdImage = open( path, O_RDONLY );
}
if ( fdImage == -1 ) {
- logadd( LOG_ERROR, "Could not open '%s' for reading...", path );
+ if ( errno != ENOENT ) {
+ logadd( LOG_ERROR, "[load] Cannot open '%s' for reading (errno=%d)", path, errno );
+ }
goto load_error;
}
// Determine file size