void-packages/srcpkgs/elfutils/patches/musl-macros.patch

75 lines
2.5 KiB
Diff

diff --git debuginfod/debuginfod-client.c debuginfod/debuginfod-client.c
index 0e5177bc..ce1d819b 100644
--- debuginfod/debuginfod-client.c
+++ debuginfod/debuginfod-client.c
@@ -212,13 +212,13 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
return 0;
/* Create the cache and config files as necessary. */
- if (stat(cache_path, &st) != 0 && mkdir(cache_path, 0777) < 0)
+ if (stat(cache_path, &st) != 0 && mkdir(cache_path, ACCESSPERMS) < 0)
return -errno;
int fd = -1;
/* init cleaning interval config file. */
- fd = open(interval_path, O_CREAT | O_RDWR, 0666);
+ fd = open(interval_path, O_CREAT | O_RDWR, DEFFILEMODE);
if (fd < 0)
return -errno;
@@ -227,7 +227,7 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
/* init max age config file. */
if (stat(maxage_path, &st) != 0
- && (fd = open(maxage_path, O_CREAT | O_RDWR, 0666)) < 0)
+ && (fd = open(maxage_path, O_CREAT | O_RDWR, DEFFILEMODE)) < 0)
return -errno;
if (dprintf(fd, "%ld", cache_default_max_unused_age_s) < 0)
diff --git lib/system.h lib/system.h
index 292082bd..5d16ebc6 100644
--- lib/system.h
+++ lib/system.h
@@ -85,6 +85,18 @@
__res; })
#endif
+#ifndef ACCESSPERMS
+#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+
+#ifndef ALLPERMS
+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+
+#ifndef DEFFILEMODE
+#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* DEFFILEMODE*/
+#endif
+
static inline ssize_t __attribute__ ((unused))
pwrite_retry (int fd, const void *buf, size_t len, off_t off)
{
diff --git src/unstrip.c src/unstrip.c
index 0257d9cc..c99ee612 100644
--- src/unstrip.c
+++ src/unstrip.c
@@ -315,7 +315,7 @@ make_directories (const char *path)
if (dir == NULL)
error(EXIT_FAILURE, errno, _("memory exhausted"));
- while (mkdir (dir, 0777) < 0 && errno != EEXIST)
+ while (mkdir (dir, ACCESSPERMS) < 0 && errno != EEXIST)
{
if (errno == ENOENT)
make_directories (dir);
@@ -2192,7 +2192,7 @@ DWARF data in '%s' not adjusted for prelinking bias; consider prelink -u"),
/* Copy the unstripped file and then modify it. */
int outfd = open (output_file, O_RDWR | O_CREAT,
- stripped_ehdr->e_type == ET_REL ? 0666 : 0777);
+ stripped_ehdr->e_type == ET_REL ? DEFFILEMODE : ACCESSPERMS);
if (outfd < 0)
error (EXIT_FAILURE, errno, _("cannot open '%s'"), output_file);
Elf *outelf = elf_begin (outfd, ELF_C_WRITE, NULL);