PATCH: Coverity CID 1637388 avoid clobbering sig

Mikael Magnusson <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
When rtsigno returns 0, we want to keep the old sig so we can say it is
an unknown signal in the next condition.
---
 Src/jobs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Src/jobs.c b/Src/jobs.c
index 94c0679b16..fc79a3f3aa 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2819,6 +2819,7 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    while (*++argv) {
 			status = zstrtol(*argv, &signame, 10);
 			if (signame == *argv) {
+			    int rtsig;
 			    signame = casemodify(signame, CASMOD_UPPER);
 			    if (!strncmp(signame, "SIG", 3))
 				signame += 3;
@@ -2836,8 +2837,8 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 				    }
 			    }
 #if defined(SIGRTMIN) && defined(SIGRTMAX)
-			    if (sig > SIGCOUNT && (sig = rtsigno(signame))) {
-				printf("%d\n", sig);
+			    if (sig > SIGCOUNT && (rtsig = rtsigno(signame))) {
+				printf("%d\n", rtsig);
 			    } else
 #endif
 			    if (sig > SIGCOUNT) {
-- 
2.38.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.