]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pinfo: use stpcpy where appropriate
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 30 Jan 2024 19:42:37 +0000 (20:42 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 31 Jan 2024 19:11:58 +0000 (20:11 +0100)
...rather than strcpy/strchr.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/pinfo.cc

index bfd338e5b85ad2e1c34a18676d9fb766e15809b7..f6a9712a4164962d1db9294a11e342fd2f62fabf 100644 (file)
@@ -515,7 +515,7 @@ const char *
 _pinfo::_ctty (char *buf)
 {
   if (!CTTY_IS_VALID (ctty))
-    strcpy (buf, "no ctty");
+    stpcpy (buf, "no ctty");
   else
     {
       device d;
@@ -1170,10 +1170,7 @@ _pinfo::cmdline (size_t& n)
       char *p;
       p = s = (char *) cmalloc_abort (HEAP_COMMUNE, n);
       for (char **a = __argv; *a; a++)
-       {
-         strcpy (p, *a);
-         p = strchr (p, '\0') + 1;
-       }
+       p = stpcpy (p, *a) + 1;
     }
   return s;
 }
@@ -1231,10 +1228,7 @@ _pinfo::environ (size_t& n)
   char *p, *s;
   p = s = (char *) cmalloc_abort (HEAP_COMMUNE, n);
   for (char **e = env; *e; e++)
-    {
-      strcpy (p, *e);
-      p = strchr (p, '\0') + 1;
-    }
+    p = stpcpy (p, *e) + 1;
   return s;
 }
 
This page took 0.032868 seconds and 5 git commands to generate.