From 2c2c337422eeec6acbebc5d0b5ff4bf4d5efc0cf Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Wed, 10 Jun 2026 22:23:08 +0200 Subject: [PATCH] fix: pass file permissions to open(2) in arch_open on POSIX The POSIX arch_open macro passed the Windows-style share flag as the mode argument of open(2) and ignored the actual permission argument. Files created by the file tape backend got mode 0200 (write-only), so a non-root user could not reopen records it had just written; mounting a freshly formatted file-backend volume failed with EDEV_RW_PERM. Running as root masked the problem. --- src/libltfs/arch/ltfs_arch_ops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libltfs/arch/ltfs_arch_ops.h b/src/libltfs/arch/ltfs_arch_ops.h index 242d6dc8..097b70c6 100644 --- a/src/libltfs/arch/ltfs_arch_ops.h +++ b/src/libltfs/arch/ltfs_arch_ops.h @@ -151,7 +151,7 @@ extern "C" { #define arch_sscanf sscanf - #define arch_open( descriptor_ptr, filename_ptr, open_flg, share_flg, unused) do{ *descriptor_ptr = open(filename_ptr, open_flg, share_flg); }while(0) + #define arch_open( descriptor_ptr, filename_ptr, open_flg, share_flg, perm) do{ *descriptor_ptr = open(filename_ptr, open_flg, perm); }while(0) #define arch_fopen(file, mode, file_ptr) do {file_ptr = fopen(file, mode);}while(0)