https://gcc.gnu.org/g:91b6b3371109346ac54e95f895b479d0b1657a75
commit r17-4445-g91b6b3371109346ac54e95f895b479d0b1657a75 Author: Xavier Del Campo Romero <[email protected]> Date: Fri Sep 18 13:19:05 2026 +0200 cobol: Do not error out on fstat(2) failure or S_ISDIR It is preferred to defer errors to the posterior call to mmap(2). gcc/cobol/ChangeLog: * cdf-copy.cc (copybook_elem_t::open_file): Do not error out on failure. Diff: --- gcc/cobol/cdf-copy.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/gcc/cobol/cdf-copy.cc b/gcc/cobol/cdf-copy.cc index 6c52b6aeeedc..e2878b33bbe3 100644 --- a/gcc/cobol/cdf-copy.cc +++ b/gcc/cobol/cdf-copy.cc @@ -283,11 +283,9 @@ copybook_elem_t::open_file( const char directory[], bool literally ) { struct stat sb; if (fstat(fd, &sb)) { error_msg(source.loc, "fstat %qs failed: %s", path, xstrerror(errno)); - goto failure; } else if (S_ISDIR(sb.st_mode)) { error_msg(source.loc, "copybook %qs is a directory", path); - goto failure; } this->source.name = path; if( ! cobol_filename(this->source.name, inode_of(fd)) ) {
