aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2017-03-03 12:07:15 -0800
committerMike Frysinger <vapier@gentoo.org>2017-03-03 12:07:15 -0800
commit4358729342fd859b7099ae9f2d2274e677bdd306 (patch)
treefb8be875426a9f5bda216a75e6fbad7b1c4c7696
parentlddtree: move parser logic into a func (diff)
downloadpax-utils-4358729342fd859b7099ae9f2d2274e677bdd306.tar.gz
pax-utils-4358729342fd859b7099ae9f2d2274e677bdd306.tar.bz2
pax-utils-4358729342fd859b7099ae9f2d2274e677bdd306.zip
paxelf: constify pax_short_* helpers
-rw-r--r--paxelf.c6
-rw-r--r--paxelf.h6
-rw-r--r--scanelf.c5
3 files changed, 8 insertions, 9 deletions
diff --git a/paxelf.c b/paxelf.c
index c614e2d..c082178 100644
--- a/paxelf.c
+++ b/paxelf.c
@@ -726,7 +726,7 @@ void unreadelf(elfobj *elf)
free(elf);
}
-char *pax_short_hf_flags(unsigned long flags)
+const char *pax_short_hf_flags(unsigned long flags)
{
static char buffer[7];
@@ -746,7 +746,7 @@ char *pax_short_hf_flags(unsigned long flags)
* lower case: explicitly disabled
* upper case: explicitly enabled
* - : default */
-char *pax_short_pf_flags(unsigned long flags)
+const char *pax_short_pf_flags(unsigned long flags)
{
static char buffer[7];
@@ -772,7 +772,7 @@ char *pax_short_pf_flags(unsigned long flags)
return buffer;
}
-char *gnu_short_stack_flags(unsigned long flags)
+const char *gnu_short_stack_flags(unsigned long flags)
{
static char buffer[4];
diff --git a/paxelf.h b/paxelf.h
index 9d609b8..a82ca80 100644
--- a/paxelf.h
+++ b/paxelf.h
@@ -50,9 +50,9 @@ typedef struct {
(phdr && VALID_RANGE(elf, EGET(phdr->p_offset), EGET(phdr->p_filesz)))
/* prototypes */
-extern char *pax_short_hf_flags(unsigned long flags);
-extern char *pax_short_pf_flags(unsigned long flags);
-extern char *gnu_short_stack_flags(unsigned long flags);
+extern const char *pax_short_hf_flags(unsigned long flags);
+extern const char *pax_short_pf_flags(unsigned long flags);
+extern const char *gnu_short_stack_flags(unsigned long flags);
extern elfobj *readelf_buffer(const char *filename, void *buffer, size_t buffer_len);
extern elfobj *_readelf_fd(const char *filename, int fd, size_t len, int read_only);
#define readelf_fd(filename, fd, len) _readelf_fd(filename, fd, len, 1)
diff --git a/scanelf.c b/scanelf.c
index ddd7722..1ead891 100644
--- a/scanelf.c
+++ b/scanelf.c
@@ -358,7 +358,7 @@ static void scanelf_file_get_symtabs(elfobj *elf, void **sym, void **str)
warn("%s: ELF hash table is corrupt", elf->filename);
}
-static char *scanelf_file_pax(elfobj *elf, char *found_pax)
+static const char *scanelf_file_pax(elfobj *elf, char *found_pax)
{
static char ret[7];
unsigned long i, shown;
@@ -397,8 +397,7 @@ static char *scanelf_file_pax(elfobj *elf, char *found_pax)
/* fall back to EI_PAX if no PT_PAX was found */
if (!*ret) {
- static char *paxflags;
- paxflags = pax_short_hf_flags(EI_PAX_FLAGS(elf));
+ const char *paxflags = pax_short_hf_flags(EI_PAX_FLAGS(elf));
if (!be_quiet || (be_quiet && EI_PAX_FLAGS(elf))) {
*found_pax = 1;
return (be_wewy_wewy_quiet ? NULL : paxflags);