https://gcc.gnu.org/g:1975cac5df24c7acd8696f7093a4ff05a1548341

commit r17-4439-g1975cac5df24c7acd8696f7093a4ff05a1548341
Author: Xavier Del Campo Romero <[email protected]>
Date:   Thu Sep 17 23:29:31 2026 +0200

    cobol: Use st_mtime for CBL_CHECK_FILE_EXIST
    
    According to the documentation [1], CBL_CHECK_FILE_EXIST updates the
    cblt-fileexist-buf instance according to the last modification date,
    which equals st_mtime on POSIX systems. Instead, st_ctim refers to the
    last file status change. [2]
    
    [1]: 
https://docs.rocketsoftware.com/bundle/visualcobolvs2022_ug_110/page/hxj1742953321498_1.html
    [2]: 
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
    
    libgcobol/ChangeLog:
    
            * compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl: Use st_mtime.

Diff:
---
 libgcobol/compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgcobol/compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl 
b/libgcobol/compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl
index f2b0be9d1e42..b6183a070419 100644
--- a/libgcobol/compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl
+++ b/libgcobol/compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl
@@ -65,7 +65,7 @@
 
            MOVE st_size TO cblte-fe-filesize.
 
-           MOVE FUNCTION posix-localtime(address of st_ctime, TM-BUFFER)
+           MOVE FUNCTION posix-localtime(address of st_mtime, TM-BUFFER)
             TO FUNC-RETURN-VALUE.
 
            IF FUNC-RETURN-VALUE <> ZERO

Reply via email to