Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Apr 2020 23:31:39 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r360028 - head/bin/sh
Message-ID:  <202004162331.03GNVdou018936@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Apr 16 23:31:39 2020
New Revision: 360028
URL: https://svnweb.freebsd.org/changeset/base/360028

Log:
  [sh] Fix a "may be unused" warning on mips-gcc
  
  mips-gcc for mips32 was complaining that c was potentially used before
  being set.  Setting it to 0 before calling fdgetsc() looks like the right
  thing to do in this instance; there's an explicit check for c == 0 later
  on.
  
  Tested: mips-gcc mips32 build, running /bin/sh on mips32

Modified:
  head/bin/sh/miscbltin.c

Modified: head/bin/sh/miscbltin.c
==============================================================================
--- head/bin/sh/miscbltin.c	Thu Apr 16 23:29:49 2020	(r360027)
+++ head/bin/sh/miscbltin.c	Thu Apr 16 23:31:39 2020	(r360028)
@@ -245,6 +245,7 @@ readcmd(int argc __unused, char **argv __unused)
 	lastnonifs = lastnonifsws = -1;
 	fdctx_init(STDIN_FILENO, &fdctx);
 	for (;;) {
+		c = 0;
 		nread = fdgetc(&fdctx, &c);
 		if (nread == -1) {
 			if (errno == EINTR) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004162331.03GNVdou018936>