From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1028539-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 02751138334
	for <garchives@archives.gentoo.org>; Thu,  7 Jun 2018 14:09:46 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 956DDE0AF3;
	Thu,  7 Jun 2018 14:09:44 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5FA81E0AE1
	for <gentoo-commits@lists.gentoo.org>; Thu,  7 Jun 2018 14:09:44 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 033CC335CA6
	for <gentoo-commits@lists.gentoo.org>; Thu,  7 Jun 2018 14:09:43 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id DD1D62C3
	for <gentoo-commits@lists.gentoo.org>; Thu,  7 Jun 2018 14:09:40 +0000 (UTC)
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org>
Message-ID: <1528346490.54ba3a5d38687d66f9b52971b3d7460d7da54df9.vapier@gentoo>
Subject: [gentoo-commits] proj/pax-utils:master commit in: /
X-VCS-Repository: proj/pax-utils
X-VCS-Files: pspax.c
X-VCS-Directories: /
X-VCS-Committer: vapier
X-VCS-Committer-Name: Mike Frysinger
X-VCS-Revision: 54ba3a5d38687d66f9b52971b3d7460d7da54df9
X-VCS-Branch: master
Date: Thu,  7 Jun 2018 14:09:40 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 4fffea6b-1a03-4229-9730-18b15a56aef1
X-Archives-Hash: 873d6636982a12eea1b66b697c41b89e

commit:     54ba3a5d38687d66f9b52971b3d7460d7da54df9
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  3 20:34:35 2017 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jun  7 04:41:30 2018 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=54ba3a5d

pspax: constify all the pointers

 pspax.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/pspax.c b/pspax.c
index c10688f..52bdd8d 100644
--- a/pspax.c
+++ b/pspax.c
@@ -75,7 +75,7 @@ static elfobj *proc_readelf(int pfd)
 	return elf;
 }
 
-static char *get_proc_name_cmdline(int pfd)
+static const char *get_proc_name_cmdline(int pfd)
 {
 	FILE *fp;
 	static char str[1024];
@@ -93,7 +93,7 @@ static char *get_proc_name_cmdline(int pfd)
 	return (str);
 }
 
-static char *get_proc_name(int pfd)
+static const char *get_proc_name(int pfd)
 {
 	FILE *fp;
 	static char str[BUFSIZ];
@@ -198,10 +198,10 @@ static int print_executable_mappings(int pfd)
 # define NOTE_TO_SELF
 #endif
 
-static struct passwd *get_proc_passwd(int pfd)
+static const struct passwd *get_proc_passwd(int pfd)
 {
 	struct stat st;
-	struct passwd *pwd = NULL;
+	const struct passwd *pwd = NULL;
 
 	if (fstatat(pfd, "stat", &st, AT_SYMLINK_NOFOLLOW) != -1)
 		pwd = getpwuid(st.st_uid);
@@ -209,7 +209,7 @@ static struct passwd *get_proc_passwd(int pfd)
 	return pwd;
 }
 
-static char *get_proc_status(int pfd, const char *name)
+static const char *get_proc_status(int pfd, const char *name)
 {
 	FILE *fp;
 	size_t len;
@@ -233,7 +233,7 @@ static char *get_proc_status(int pfd, const char *name)
 	return NULL;
 }
 
-static char *get_pid_attr(int pfd)
+static const char *get_pid_attr(int pfd)
 {
 	FILE *fp;
 	char *p;
@@ -250,7 +250,7 @@ static char *get_pid_attr(int pfd)
 	return buf;
 }
 
-static char *get_pid_addr(int pfd)
+static const char *get_pid_addr(int pfd)
 {
 	FILE *fp;
 	char *p;
@@ -281,7 +281,7 @@ static const char *get_proc_type(int pfd)
 	return ret;
 }
 
-static char *scanelf_file_phdr(elfobj *elf)
+static const char *scanelf_file_phdr(elfobj *elf)
 {
 	static char ret[8];
 	unsigned long i, off, multi_stack, multi_load;
@@ -294,8 +294,8 @@ static char *scanelf_file_phdr(elfobj *elf)
 	uint32_t flags;
 #define SHOW_PHDR(B) \
 	if (elf->elf_class == ELFCLASS ## B) { \
-	Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
-	Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
+	const Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
+	const Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
 	for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
 		if (EGET(phdr[i].p_type) == PT_GNU_STACK) { \
 			if (multi_stack++) warnf("%s: multiple PT_GNU_STACK's !?", elf->filename); \
@@ -336,7 +336,7 @@ static void pspax(const char *find_name)
 	pid_t pid;
 	pid_t ppid = show_pid;
 	int have_attr, have_addr, wx;
-	struct passwd *pwd;
+	const struct passwd *pwd;
 	const char *pax, *type, *name, *attr, *addr;
 	char *caps;
 	int pfd;
@@ -375,7 +375,7 @@ static void pspax(const char *find_name)
 			continue;
 
 		if (find_name && pid) {
-			char *str = get_proc_name(pfd);
+			const char *str = get_proc_name(pfd);
 			if (!str)
 				goto next_pid;
 			if (strcmp(str, find_name) != 0)
@@ -504,8 +504,8 @@ static void usage(int status)
 static void parseargs(int argc, char *argv[])
 {
 	int flag;
-	struct passwd *pwd = NULL;
-	struct  group *gwd = NULL;
+	const struct passwd *pwd = NULL;
+	const struct  group *gwd = NULL;
 
 	opterr = 0;
 	while ((flag=getopt_long(argc, argv, PARSE_FLAGS, long_opts, NULL)) != -1) {
@@ -563,7 +563,7 @@ static void parseargs(int argc, char *argv[])
 
 int main(int argc, char *argv[])
 {
-	char *name = NULL;
+	const char *name = NULL;
 
 	/* We unshare pidns but don't actually enter it.  That means
 	 * we still get to scan /proc, but just not fork children.  */