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

Keith Packard keithp@keithp.com
Thu Aug 20 22:14:48 GMT 2020


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(-)

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;
 	}
-- 
2.28.0



More information about the Newlib mailing list