From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Buesch Date: Sat, 05 Feb 2005 22:36:50 +0000 Subject: Re: [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes Message-Id: <200502052336.56404.mbuesch@freenet.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="nextPart7013530.gWgkEie4UA" List-Id: References: <200502051818.54277.mbuesch@freenet.de> In-Reply-To: <200502051818.54277.mbuesch@freenet.de> To: linux-hotplug@vger.kernel.org --nextPart7013530.gWgkEie4UA Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Quoting Paul Jackson : > Michael wrote: > > while (len > 0 && path[len-1] =3D=3D '/') >=20 > I think you'd better make that: >=20 > while (len > 1 && path[len-1] =3D=3D '/') >=20 > or else you can eat your last slash. >=20 > The call no_trailing_slash("/") should produce "/", not "". Well, I would call that expected behaviour. Consider the following: char buf[SIZE]; strcpy(buf, "///"); no_trailing_slash(buf); strcat(buf, "/foo/bar"); I would expect that to expand to "/foo/bar" and _not_ to "//foo/bar" as you suggest. > Not that anyone is likely to call no_trailing_slash("////") > very often ;). >=20 =2D-=20 Regards Michael Buesch [ http://www.tuxsoft.de.vu ] --nextPart7013530.gWgkEie4UA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBCBUqIFGK1OIvVOP4RAoRsAKCdo5gIfUmxRbl2VXsNp3nP64vKTgCgm/Z7 DiWYYMjkKVybCD5ZMvEvv3I= =TBtj -----END PGP SIGNATURE----- --nextPart7013530.gWgkEie4UA-- ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel