Ticket #4103: mc-4103-cid-ioblksize.h-fix-big-parameter-passed-by-value-warning.patch

File mc-4103-cid-ioblksize.h-fix-big-parameter-passed-by-value-warning.patch, 1.3 KB (added by and, 20 months ago)
  • src/filemanager/file.c

    From 4ca731b84fae2407c7194de69dffb26c4d5fc966 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Tue, 22 Dec 2020 09:16:51 +0000
    Subject: [PATCH] (ioblksize.h) fix Big parameter passed by value warning
    
    found by Coverity
    coverity id #164546
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/file.c      | 2 +-
     src/filemanager/ioblksize.h | 4 ++--
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/src/filemanager/file.c b/src/filemanager/file.c
    index 7d8fa9960..04ed9e051 100644
    a b copy_file_file (file_op_total_context_t * tctx, file_op_context_t * ctx, 
    25282528 
    25292529        tv_last_update = tv_transfer_start; 
    25302530 
    2531         bufsize = io_blksize (dst_stat); 
     2531        bufsize = io_blksize (&dst_stat); 
    25322532        buf = g_malloc (bufsize); 
    25332533 
    25342534        while (TRUE) 
  • src/filemanager/ioblksize.h

    diff --git a/src/filemanager/ioblksize.h b/src/filemanager/ioblksize.h
    index 3a8b50181..3420c183d 100644
    a b enum { IO_BUFSIZE = 128 * 1024 }; 
    7878/* *INDENT-ON* */ 
    7979 
    8080static inline size_t 
    81 io_blksize (struct stat sb) 
     81io_blksize (struct stat *sb) 
    8282{ 
    83     size_t blksize = ST_BLKSIZE (sb); 
     83    size_t blksize = ST_BLKSIZE (*sb); 
    8484 
    8585    return MAX (IO_BUFSIZE, blksize); 
    8686}