summaryrefslogtreecommitdiff
path: root/tests/fillfile.c
diff options
context:
space:
mode:
authorÉrico Rolim <erico.erc@gmail.com>2020-11-01 22:49:46 -0300
committerMark Wielaard <mark@klomp.org>2020-11-03 15:54:14 +0100
commitced66615bd8c3671c50252cba254fb939b04e362 (patch)
treeb26cee9fe348001db1660cfd464107fcc37765b3 /tests/fillfile.c
parent95ec1659cdd134a5fd260fffd9e3220909851903 (diff)
downloadelfutils-ced66615bd8c3671c50252cba254fb939b04e362.tar.gz
Switch from numerical to defined constants for permissions.
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 <erico.erc@gmail.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'tests/fillfile.c')
-rw-r--r--tests/fillfile.c7
1 files changed, 4 insertions, 3 deletions
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 <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "system.h"
#include ELFUTILS_HEADER(elf)
#include <gelf.h>
@@ -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));