[Pkg-shadow-devel] [PATCH] libmisc: clean up const warnings

Mike Frysinger vapier at gentoo.org
Thu Nov 3 04:37:59 UTC 2011


Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 libmisc/console.c     |    3 ++-
 libmisc/failure.c     |    2 +-
 libmisc/hushed.c      |    2 +-
 libmisc/list.c        |    2 +-
 libmisc/loginprompt.c |    2 +-
 libmisc/motd.c        |    5 +++--
 libmisc/obscure.c     |    2 +-
 libmisc/setugid.c     |    2 +-
 libmisc/setupenv.c    |    4 ++--
 libmisc/sulog.c       |    2 +-
 libmisc/ttytype.c     |    2 +-
 11 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/libmisc/console.c b/libmisc/console.c
index 20fbd7f..ed6026d 100644
--- a/libmisc/console.c
+++ b/libmisc/console.c
@@ -50,7 +50,8 @@ static bool is_listed (const char *cfgin, const char *tty, bool def);
 static bool is_listed (const char *cfgin, const char *tty, bool def)
 {
 	FILE *fp;
-	char buf[200], *cons, *s;
+	char buf[200], *s;
+	const char *cons;
 
 	/*
 	 * If the CONSOLE configuration definition isn't given,
diff --git a/libmisc/failure.c b/libmisc/failure.c
index 1a1e3d4..6363fb8 100644
--- a/libmisc/failure.c
+++ b/libmisc/failure.c
@@ -296,7 +296,7 @@ void failtmp (const char *username,
 #endif				/* !USE_UTMPX */
     )
 {
-	char *ftmp;
+	const char *ftmp;
 	int fd;
 
 	/*
diff --git a/libmisc/hushed.c b/libmisc/hushed.c
index c849ebf..d1aa06e 100644
--- a/libmisc/hushed.c
+++ b/libmisc/hushed.c
@@ -50,7 +50,7 @@
 bool hushed (const char *username)
 {
 	struct passwd *pw;
-	char *hushfile;
+	const char *hushfile;
 	char buf[BUFSIZ];
 	bool found;
 	FILE *fp;
diff --git a/libmisc/list.c b/libmisc/list.c
index f9aa0b8..2ebc7d8 100644
--- a/libmisc/list.c
+++ b/libmisc/list.c
@@ -187,7 +187,7 @@ bool is_on_list (char *const *list, const char *member)
 	char *members;
 	char **array;
 	int i;
-	const char *cp;
+	char *cp;
 	char *cp2;
 
 	assert (NULL != comma);
diff --git a/libmisc/loginprompt.c b/libmisc/loginprompt.c
index 3ca8938..6dfd716 100644
--- a/libmisc/loginprompt.c
+++ b/libmisc/loginprompt.c
@@ -88,7 +88,7 @@ void login_prompt (const char *prompt, char *name, int namesize)
 	 */
 
 	if (NULL != prompt) {
-		cp = getdef_str ("ISSUE_FILE");
+		const char *cp = getdef_str ("ISSUE_FILE");
 		if (NULL != cp) {
 			fp = fopen (cp, "r");
 			if (NULL != fp) {
diff --git a/libmisc/motd.c b/libmisc/motd.c
index 65db7cb..9696003 100644
--- a/libmisc/motd.c
+++ b/libmisc/motd.c
@@ -48,12 +48,13 @@ void motd (void)
 {
 	FILE *fp;
 	char motdlist[BUFSIZ], *motdfile, *mb;
+	const char *def;
 	register int c;
 
-	if ((mb = getdef_str ("MOTD_FILE")) == NULL)
+	if ((def = getdef_str ("MOTD_FILE")) == NULL)
 		return;
 
-	strncpy (motdlist, mb, sizeof (motdlist));
+	strncpy (motdlist, def, sizeof (motdlist));
 	motdlist[sizeof (motdlist) - 1] = '\0';
 
 	for (mb = motdlist; (motdfile = strtok (mb, ":")) != NULL; mb = NULL) {
diff --git a/libmisc/obscure.c b/libmisc/obscure.c
index 7088662..f3e2754 100644
--- a/libmisc/obscure.c
+++ b/libmisc/obscure.c
@@ -226,7 +226,7 @@ static const char *obscure_msg (const char *old, const char *new,
 	size_t maxlen, oldlen, newlen;
 	char *new1, *old1;
 	const char *msg;
-	char *result;
+	const char *result;
 
 	oldlen = strlen (old);
 	newlen = strlen (new);
diff --git a/libmisc/setugid.c b/libmisc/setugid.c
index 997095e..9e23db0 100644
--- a/libmisc/setugid.c
+++ b/libmisc/setugid.c
@@ -131,7 +131,7 @@ int setup_uid_gid (const struct passwd *info)
 
 #if defined (HAVE_INITGROUPS) && ! defined (USE_PAM)
 	if (is_console) {
-		char *cp = getdef_str ("CONSOLE_GROUPS");
+		const char *cp = getdef_str ("CONSOLE_GROUPS");
 
 		if ((NULL != cp) && (add_groups (cp) != 0)) {
 			perror ("Warning: add_groups");
diff --git a/libmisc/setupenv.c b/libmisc/setupenv.c
index 36feb9b..f8f220f 100644
--- a/libmisc/setupenv.c
+++ b/libmisc/setupenv.c
@@ -200,9 +200,9 @@ static void read_env_file (const char *filename)
 void setup_env (struct passwd *info)
 {
 #ifndef USE_PAM
-	char *envf;
+	const char *envf;
 #endif
-	char *cp;
+	const char *cp;
 
 	/*
 	 * Change the current working directory to be the home directory
diff --git a/libmisc/sulog.c b/libmisc/sulog.c
index 76ae556..6115021 100644
--- a/libmisc/sulog.c
+++ b/libmisc/sulog.c
@@ -47,7 +47,7 @@
  */
 void sulog (const char *tty, bool success, const char *oldname, const char *name)
 {
-	char *sulog_file;
+	const char *sulog_file;
 	time_t now;
 	struct tm *tm;
 	FILE *fp;
diff --git a/libmisc/ttytype.c b/libmisc/ttytype.c
index fdaf2dc..7df0d9e 100644
--- a/libmisc/ttytype.c
+++ b/libmisc/ttytype.c
@@ -45,7 +45,7 @@ void ttytype (const char *line)
 {
 	FILE *fp;
 	char buf[BUFSIZ];
-	char *typefile;
+	const char *typefile;
 	char *cp;
 	char type[BUFSIZ];
 	char port[BUFSIZ];
-- 
1.7.6.1




More information about the Pkg-shadow-devel mailing list