From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRTO2-0006PL-2r for qemu-devel@nongnu.org; Thu, 04 Feb 2016 18:32:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRTNy-0002Ak-2o for qemu-devel@nongnu.org; Thu, 04 Feb 2016 18:32:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRTNx-0002Ac-UA for qemu-devel@nongnu.org; Thu, 04 Feb 2016 18:32:26 -0500 References: <1454597781-18115-1-git-send-email-alex.bennee@linaro.org> <1454597781-18115-6-git-send-email-alex.bennee@linaro.org> <56B3D01C.9080405@twiddle.net> From: Eric Blake Message-ID: <56B3DF84.1010109@redhat.com> Date: Thu, 4 Feb 2016 16:32:20 -0700 MIME-Version: 1.0 In-Reply-To: <56B3D01C.9080405@twiddle.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aGIXtQ4uwPcr3XOKshc6f37EA5KjvOsR8" Subject: Re: [Qemu-devel] [PATCH v5 5/9] qemu-log: support simple pid substitution in logfile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , =?UTF-8?Q?Alex_Benn=c3=a9e?= , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, crosthwaitepeter@gmail.com, dgilbert@redhat.com, aurelien@aurel32.net, peter.maydell@linaro.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --aGIXtQ4uwPcr3XOKshc6f37EA5KjvOsR8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/04/2016 03:26 PM, Richard Henderson wrote: > On 02/05/2016 01:56 AM, Alex Benn=C3=A9e wrote: >> + if (g_strrstr(filename, "%d")) { >> + /* if we are going to format this we'd better validate first = */ >> + if (g_regex_match_simple("^[^%]+%d[^%]+$", filename, 0, 0)) {= >=20 > Why g_strrstr instead of strstr? There should be only one, so why look= > for the last? For that matter, why use a heavyweight regex, when you can achieve the same validation with the faster: char *tmp =3D strchr(filename, '%'); if (tmp) { if (tmp[1] !=3D 'd' || strchr(tmp + 2, '%')) { ...report invalid string } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --aGIXtQ4uwPcr3XOKshc6f37EA5KjvOsR8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWs9+EAAoJEKeha0olJ0NqUMsIAIssWR1U+aHpTAL9FIMGLnAb PNj1r39zftZSs31CHn/kvHTMUv6iYXqyjUbzOxQiD1EVlqlPfvO7t9y6E/m0qBe2 EloVomRiDk9wBKGcwt9EQ/ICazqWckiJMxboX9/jPcMowe9n6Z++dTuAgQzJ4aLt kCVJh2yhJVnRhzsK7InivW26tQDY6T9iSdjXX2sPlrXXd6m3gRrOuD4aNCURPaYT jY+vYmOketEZgZ6r8jixMbXMFuIi7rAfn8JefeQelMpDkQCdtQhyH5jyBSf1xN5q 77o6L6uhCQMRHbRCqQhiSeb2gRfJP20NNA7EQfKvwuL8H3oCqr0LgvjPB7OYZew= =+ouN -----END PGP SIGNATURE----- --aGIXtQ4uwPcr3XOKshc6f37EA5KjvOsR8--