From ced66615bd8c3671c50252cba254fb939b04e362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Sun, 1 Nov 2020 22:49:46 -0300 Subject: Switch from numerical to defined constants for permissions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use defined constants for permission values. Also add fallback definitions for them in system.h, to allow for compatibility with systems that don't provide these macros. Include system.h in all tests/ files that required it. Signed-off-by: Érico Rolim Signed-off-by: Mark Wielaard --- tests/fillfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/fillfile.c') diff --git a/tests/fillfile.c b/tests/fillfile.c index 915e249d..7f622536 100644 --- a/tests/fillfile.c +++ b/tests/fillfile.c @@ -27,6 +27,7 @@ #include #include #include +#include "system.h" #include ELFUTILS_HEADER(elf) #include @@ -201,7 +202,7 @@ check_elf (const char *fname, int class, int use_mmap) printf ("\nfname: %s\n", fname); stridx = 0; // Reset strtab strings index - int fd = open (fname, O_RDWR | O_CREAT | O_TRUNC, 0666); + int fd = open (fname, O_RDWR | O_CREAT | O_TRUNC, DEFFILEMODE); if (fd == -1) { printf ("cannot open `%s': %s\n", fname, strerror (errno)); @@ -266,7 +267,7 @@ check_elf (const char *fname, int class, int use_mmap) /* Reread the ELF from disk now. */ printf ("Rereading %s\n", fname); - fd = open (fname, O_RDWR, 0666); + fd = open (fname, O_RDWR); if (fd == -1) { printf ("cannot (re)open `%s': %s\n", fname, strerror (errno)); @@ -347,7 +348,7 @@ check_elf (const char *fname, int class, int use_mmap) // And read it in one last time. printf ("Rereading %s again\n", fname); - fd = open (fname, O_RDONLY, 0666); + fd = open (fname, O_RDONLY); if (fd == -1) { printf ("cannot open `%s' read-only: %s\n", fname, strerror (errno)); -- cgit v1.2.1