From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 1ED4338582A7; Thu, 1 Feb 2024 11:39:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1ED4338582A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706787580; bh=utD7rEJilcB7FCnd9oTkM/+T3zdbw3ugpkIs2JVHjPA=; h=From:To:Subject:Date:From; b=ossZPj/AFU8uUHvGIkv3Bv38130mhwP3Qabs8qtmZlVyow9jYDZ69QwYSHZQCvXhl d3qTjmLzLj3cjgj1oRGZTCpKhtl1taMv01yHaTq8vV8zxpABeXPKdN1QPaVn52ZWUr l9+kd54OZRUPbav8atI0UsB447xooeO55kkAJLVY= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: pinfo: use stpcpy where appropriate X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 3600654b78cc5e1482330d6d03ca87d5aeab04de X-Git-Newrev: b1d64ac265f01f2efcff495b963982ca741269d9 Message-Id: <20240201113940.1ED4338582A7@sourceware.org> Date: Thu, 1 Feb 2024 11:39:39 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Db1d64ac265f= 01f2efcff495b963982ca741269d9 commit b1d64ac265f01f2efcff495b963982ca741269d9 Author: Corinna Vinschen AuthorDate: Tue Jan 30 20:42:37 2024 +0100 Commit: Corinna Vinschen CommitDate: Wed Jan 31 20:11:58 2024 +0100 Cygwin: pinfo: use stpcpy where appropriate =20 ...rather than strcpy/strchr. =20 Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/pinfo.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index bfd338e5b85a..f6a9712a4164 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -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 =3D s =3D (char *) cmalloc_abort (HEAP_COMMUNE, n); for (char **a =3D __argv; *a; a++) - { - strcpy (p, *a); - p =3D strchr (p, '\0') + 1; - } + p =3D stpcpy (p, *a) + 1; } return s; } @@ -1231,10 +1228,7 @@ _pinfo::environ (size_t& n) char *p, *s; p =3D s =3D (char *) cmalloc_abort (HEAP_COMMUNE, n); for (char **e =3D env; *e; e++) - { - strcpy (p, *e); - p =3D strchr (p, '\0') + 1; - } + p =3D stpcpy (p, *e) + 1; return s; }