[5/6] libc/stdlib: Clean up clang warnings

Message ID 20200820221449.686006-6-keithp@keithp.com
State New
Headers show
Series
  • Fixes inspired by building with clang
Related show

Commit Message

Corinna Vinschen via Newlib Aug. 20, 2020, 10:14 p.m.
Eliminate hand-written strcpy in setenv.

Signed-off-by: Keith Packard <keithp@keithp.com>

---
 newlib/libc/stdlib/setenv_r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.28.0

Patch

diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c
index 84d87a6ed..cdfa04f33 100644
--- a/newlib/libc/stdlib/setenv_r.c
+++ b/newlib/libc/stdlib/setenv_r.c
@@ -75,7 +75,7 @@  _setenv_r (struct _reent *reent_ptr,
         }
       if (strlen (C) >= l_value)
 	{			/* old larger; copy over */
-	  while ((*C++ = *value++) != 0);
+	  strcpy(C, value);
           ENV_UNLOCK;
 	  return 0;
 	}