From 7cfe0fc001a0931176d0ea13b1a4cc39bce8096e Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Fri, 3 Oct 2025 23:11:47 +0200
Subject: [PATCH 10/11] Fix gcc 12.5 -Wenum-conversion warnings.

Just cast. All affected enums are compatible.
---
 libexec/ypxfr/ypxfr_getmap.c   |  4 ++--
 libexec/ypxfr/ypxfr_main.c     | 10 ++++++----
 libexec/ypxfr/ypxfr_misc.c     | 32 ++++++++++++++++----------------
 usr.sbin/rpc.lockd/lock_proc.c | 12 ++++++------
 usr.sbin/yppush/yppush_main.c  |  4 ++--
 5 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/libexec/ypxfr/ypxfr_getmap.c b/libexec/ypxfr/ypxfr_getmap.c
index 8267d3729c..3fb45b99f1 100644
--- a/libexec/ypxfr/ypxfr_getmap.c
+++ b/libexec/ypxfr/ypxfr_getmap.c
@@ -71,7 +71,7 @@ ypxfr_get_map(char *map, char *domain, char *host,
 	if ((clnt = clnt_create(host, YPPROG, YPVERS, "tcp")) == NULL) {
 		yp_error("%s", clnt_spcreateerror("failed to \
 create tcp handle"));
-		yp_errno = YPXFR_YPERR;
+		yp_errno = (enum ypstat)YPXFR_YPERR;
 		return(1);
 	}
 
@@ -89,7 +89,7 @@ create tcp handle"));
 		return(0);
 
 	if (status != YP_TRUE) {
-		yp_errno = YPXFR_YPERR;
+		yp_errno = (enum ypstat)YPXFR_YPERR;
 		return(1);
 	}
 
diff --git a/libexec/ypxfr/ypxfr_main.c b/libexec/ypxfr/ypxfr_main.c
index 825a0bee2a..f851b5db44 100644
--- a/libexec/ypxfr/ypxfr_main.c
+++ b/libexec/ypxfr/ypxfr_main.c
@@ -90,7 +90,7 @@ ypxfr_exit(ypxfrstat retval, char *temp)
 			exit(1);
 		}
 
-		ypxfr_resp.status = retval;
+		ypxfr_resp.status = (yppush_status)retval;
 
 		if (yppushproc_xfrresp_1(&ypxfr_resp, clnt) == NULL) {
 			yp_error("%s", clnt_sperror(clnt, "callback failed"));
@@ -331,7 +331,7 @@ the local domain name isn't set");
 					     	ypxfr_use_yplib)) == NULL) {
 			yp_error("failed to find master of %s in domain %s: %s",
 				  ypxfr_mapname, ypxfr_source_domain,
-				  ypxfrerr_string(yp_errno));
+				  ypxfrerr_string((ypxfrstat)yp_errno));
 			ypxfr_exit(YPXFR_MADDR,NULL);
 		}
 	}
@@ -360,7 +360,8 @@ the local domain name isn't set");
 					     ypxfr_master, 0)) == 0) {
 		yp_error("failed to get order number of %s: %s",
 				ypxfr_mapname, yp_errno == YP_TRUE ?
-				"map has order 0" : ypxfrerr_string(yp_errno));
+				"map has order 0" :
+				ypxfrerr_string((ypxfrstat)yp_errno));
 		ypxfr_exit(YPXFR_YPERR,NULL);
 	}
 
@@ -535,7 +536,8 @@ the local domain name isn't set");
 					     ypxfr_master, 0)) == 0) {
 		yp_error("failed to get order number of %s: %s",
 				ypxfr_mapname, yp_errno == YP_TRUE ?
-				"map has order 0" : ypxfrerr_string(yp_errno));
+				"map has order 0" :
+				ypxfrerr_string((ypxfrstat)yp_errno));
 		ypxfr_exit(YPXFR_YPERR, ypxfr_temp_map);
 	}
 
diff --git a/libexec/ypxfr/ypxfr_misc.c b/libexec/ypxfr/ypxfr_misc.c
index af6b86decd..8bcbdd5a17 100644
--- a/libexec/ypxfr/ypxfr_misc.c
+++ b/libexec/ypxfr/ypxfr_misc.c
@@ -130,14 +130,14 @@ ypxfr_get_master(char *domain, char *map, char *source, const int yplib)
 		if ((res = yp_master(domain, map, &master))) {
 			switch (res) {
 			case YPERR_DOMAIN:
-				yp_errno = YPXFR_NODOM;
+				yp_errno = (enum ypstat)YPXFR_NODOM;
 				break;
 			case YPERR_MAP:
-				yp_errno = YPXFR_NOMAP;
+				yp_errno = (enum ypstat)YPXFR_NOMAP;
 				break;
 			case YPERR_YPERR:
 			default:
-				yp_errno = YPXFR_YPERR;
+				yp_errno = (enum ypstat)YPXFR_YPERR;
 				break;
 			}
 			return(NULL);
@@ -154,7 +154,7 @@ ypxfr_get_master(char *domain, char *map, char *source, const int yplib)
 		if ((clnt = clnt_create(source,YPPROG,YPVERS,"udp")) == NULL) {
 			yp_error("%s",clnt_spcreateerror("failed to \
 create udp handle to ypserv"));
-			yp_errno = YPXFR_RPC;
+			yp_errno = (enum ypstat)YPXFR_RPC;
 			return(NULL);
 		}
 
@@ -164,21 +164,21 @@ create udp handle to ypserv"));
 			yp_error("%s",clnt_sperror(clnt,"YPPROC_MASTER \
 failed"));
 			clnt_destroy(clnt);
-			yp_errno = YPXFR_RPC;
+			yp_errno = (enum ypstat)YPXFR_RPC;
 			return(NULL);
 		}
 		clnt_destroy(clnt);
 		if (resp->stat != YP_TRUE) {
 			switch (resp->stat) {
 			case YP_NODOM:
-				yp_errno = YPXFR_NODOM;
+				yp_errno = (enum ypstat)YPXFR_NODOM;
 				break;
 			case YP_NOMAP:
-				yp_errno = YPXFR_NOMAP;
+				yp_errno = (enum ypstat)YPXFR_NOMAP;
 				break;
 			case YP_YPERR:
 			default:
-				yp_errno = YPXFR_YPERR;
+				yp_errno = (enum ypstat)YPXFR_YPERR;
 				break;
 			}
 			return(NULL);
@@ -198,14 +198,14 @@ ypxfr_get_order(char *domain, char *map, char *source, const int yplib)
 		if ((res = yp_order(domain, map, (int *)&order))) {
 			switch (res) {
 			case YPERR_DOMAIN:
-				yp_errno = YPXFR_NODOM;
+				yp_errno = (enum ypstat)YPXFR_NODOM;
 				break;
 			case YPERR_MAP:
-				yp_errno = YPXFR_NOMAP;
+				yp_errno = (enum ypstat)YPXFR_NOMAP;
 				break;
 			case YPERR_YPERR:
 			default:
-				yp_errno = YPXFR_YPERR;
+				yp_errno = (enum ypstat)YPXFR_YPERR;
 				break;
 			}
 			return(0);
@@ -219,7 +219,7 @@ ypxfr_get_order(char *domain, char *map, char *source, const int yplib)
 		if ((clnt = clnt_create(source,YPPROG,YPVERS,"udp")) == NULL) {
 			yp_error("%s",clnt_spcreateerror("couldn't create \
 udp handle to ypserv"));
-			yp_errno = YPXFR_RPC;
+			yp_errno = (enum ypstat)YPXFR_RPC;
 			return(0);
 		}
 		req.map = map;
@@ -228,21 +228,21 @@ udp handle to ypserv"));
 			yp_error("%s", clnt_sperror(clnt, "YPPROC_ORDER \
 failed"));
 			clnt_destroy(clnt);
-			yp_errno = YPXFR_RPC;
+			yp_errno = (enum ypstat)YPXFR_RPC;
 			return(0);
 		}
 		clnt_destroy(clnt);
 		if (resp->stat != YP_TRUE) {
 			switch (resp->stat) {
 			case YP_NODOM:
-				yp_errno = YPXFR_NODOM;
+				yp_errno = (enum ypstat)YPXFR_NODOM;
 				break;
 			case YP_NOMAP:
-				yp_errno = YPXFR_NOMAP;
+				yp_errno = (enum ypstat)YPXFR_NOMAP;
 				break;
 			case YP_YPERR:
 			default:
-				yp_errno = YPXFR_YPERR;
+				yp_errno = (enum ypstat)YPXFR_YPERR;
 				break;
 			}
 			return(0);
diff --git a/usr.sbin/rpc.lockd/lock_proc.c b/usr.sbin/rpc.lockd/lock_proc.c
index ede52f6dd1..65477f6000 100644
--- a/usr.sbin/rpc.lockd/lock_proc.c
+++ b/usr.sbin/rpc.lockd/lock_proc.c
@@ -905,7 +905,7 @@ nlm4_lock_4_svc(nlm4_lockargs *arg, struct svc_req *rqstp)
 	/* copy cookie from arg to result.  See comment in nlm_test_4() */
 	res.cookie = arg->cookie;
 
-	res.stat.stat = getlock(arg, rqstp, LOCK_MON | LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)getlock(arg, rqstp, LOCK_MON | LOCK_V4);
 	return (&res);
 }
 
@@ -918,7 +918,7 @@ nlm4_lock_msg_4_svc(nlm4_lockargs *arg, struct svc_req *rqstp)
 		log_from_addr("nlm4_lock_msg", rqstp);
 
 	res.cookie = arg->cookie;
-	res.stat.stat = getlock(arg, rqstp, LOCK_MON | LOCK_ASYNC | LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)getlock(arg, rqstp, LOCK_MON | LOCK_ASYNC | LOCK_V4);
 	transmit4_result(NLM4_LOCK_RES, &res, getrpcaddr(rqstp));
 
 	return (NULL);
@@ -945,7 +945,7 @@ nlm4_cancel_4_svc(nlm4_cancargs *arg, struct svc_req *rqstp)
 	 * Since at present we never return 'nlm_blocked', there can never be
 	 * a lock to cancel, so this call always fails.
 	 */
-	res.stat.stat = unlock(&arg->alock, LOCK_CANCEL);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_CANCEL);
 	return (&res);
 }
 
@@ -962,7 +962,7 @@ nlm4_cancel_msg_4_svc(nlm4_cancargs *arg, struct svc_req *rqstp)
 	 * Since at present we never return 'nlm_blocked', there can never be
 	 * a lock to cancel, so this call always fails.
 	 */
-	res.stat.stat = unlock(&arg->alock, LOCK_CANCEL | LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_CANCEL | LOCK_V4);
 	transmit4_result(NLM4_CANCEL_RES, &res, getrpcaddr(rqstp));
 	return (NULL);
 }
@@ -983,7 +983,7 @@ nlm4_unlock_4_svc(nlm4_unlockargs *arg, struct svc_req *rqstp)
 	if (debug_level)
 		log_from_addr("nlm4_unlock", rqstp);
 
-	res.stat.stat = unlock(&arg->alock, LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_V4);
 	res.cookie = arg->cookie;
 
 	return (&res);
@@ -997,7 +997,7 @@ nlm4_unlock_msg_4_svc(nlm4_unlockargs *arg, struct svc_req *rqstp)
 	if (debug_level)
 		log_from_addr("nlm4_unlock_msg", rqstp);
 
-	res.stat.stat = unlock(&arg->alock, LOCK_V4);
+	res.stat.stat = (enum nlm4_stats)unlock(&arg->alock, LOCK_V4);
 	res.cookie = arg->cookie;
 
 	transmit4_result(NLM4_UNLOCK_RES, &res, getrpcaddr(rqstp));
diff --git a/usr.sbin/yppush/yppush_main.c b/usr.sbin/yppush/yppush_main.c
index 2f42e44aa5..c370df304e 100644
--- a/usr.sbin/yppush/yppush_main.c
+++ b/usr.sbin/yppush/yppush_main.c
@@ -268,7 +268,7 @@ void *
 yppushproc_xfrresp_1_svc(yppushresp_xfr *argp, struct svc_req *rqstp)
 {
 	static char * result;
-	yppush_show_status(argp->status, argp->transid);
+	yppush_show_status((ypxfrstat)argp->status, argp->transid);
 	return((void *) &result);
 }
 
@@ -327,7 +327,7 @@ create udp handle to NIS server"));
 				job->stat = YPPUSH_PMAP;
 				break;
 			default:
-				job->stat = YPPUSH_RPC;
+				job->stat = (ypxfrstat)YPPUSH_RPC;
 				break;
 			}
 		return(1);
-- 
2.45.2

