File idmap-0001-Removed-some-unused-and-set-but-not-used-warnings.patch of Package nfs-utils.35068

From 3d9fa674edce23a889532cd68ad9dd4decfcd533 Mon Sep 17 00:00:00 2001
From: Steve Dickson <steved@redhat.com>
Date: Thu, 9 Oct 2014 17:19:13 -0400
Subject: [PATCH] Removed some unused and set but not used warnings

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 static.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

--- a/static.c
+++ b/static.c
@@ -39,6 +39,7 @@
 #include <pwd.h>
 #include <grp.h>
 #include <errno.h>
+#include <err.h>
 
 #include "queue.h"
 #include "cfg.h"
@@ -268,7 +269,6 @@ static int static_name_to_gid(char *name
 
 static int static_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
 {
-	struct passwd *pw;
 	struct uid_mapping * um;
 
 	for (um = LIST_FIRST (&uid_mappings[uid_hash (uid)]); um;
@@ -284,7 +284,6 @@ static int static_uid_to_name(uid_t uid,
 
 static int static_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
 {
-	struct group *gr;
 	struct gid_mapping * gm;
 
 	for (gm = LIST_FIRST (&gid_mappings[gid_hash (gid)]); gm;
@@ -305,7 +304,6 @@ static int static_gid_to_name(gid_t gid,
 
 static int static_init() {	
 	int err;
-	uid_t uid;
 	struct conf_list * princ_list = NULL;
 	struct conf_list_node * cln, *next;
 	struct uid_mapping * unode;
@@ -367,7 +365,7 @@ static int static_init() {
 		next = TAILQ_NEXT (cln, link); 
 
 		gr = static_getgrnam(cln->field, NULL, &err);
-		if (!pw) {
+		if (!gr) {
 			continue;
 		}
 		
@@ -376,19 +374,19 @@ static int static_init() {
 		{
 			warnx("static_init: calloc (1, %lu) failed",
 				(unsigned long)sizeof *gnode);
-			free(pw);
+			free(gr);
 			return -ENOMEM;
 		}
-		gnode->gid = pw->pw_uid;
+		gnode->gid = gr->gr_gid;
 		gnode->principal = strdup(cln->field);
 
 		gnode->localgroup = conf_get_str("Static", cln->field);
 		if (!gnode->localgroup) {
-			free(pw);
+			free(gr);
 			return -ENOENT;
 		}
 
-		free(pw);
+		free(gr);
 
 		LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link);
 	}
openSUSE Build Service is sponsored by