Fix download space check when mount entry is missing

This commit is contained in:
zhangtao
2025-12-19 16:59:13 +08:00
committed by Jianhui Zhao
parent 37fb2125f3
commit bf02cb9183
+13 -2
View File
@@ -317,8 +317,19 @@ static void start_download_file(struct file_context *ctx, struct buffer *info, i
goto check_space_fail; goto check_space_fail;
} }
} else { } else {
log_err("download file fail: not found mount point of '%s'\n", savepath); uint64_t avail;
goto check_space_fail;
if (!statvfs(savepath, &sfs)) {
avail = sfs.f_bavail * sfs.f_frsize;
if (ctx->total_size > avail) {
log_err("download file fail: no enough space\n");
goto check_space_fail;
}
} else {
log_err("download file fail: not found mount point of '%s'\n", savepath);
goto check_space_fail;
}
} }
buffer_pull(info, name, len - 4); buffer_pull(info, name, len - 4);