Date: Wed, 20 Oct 2010 15:46:00 -0700 From: Garrett Cooper <gcooper@FreeBSD.org> To: Matthew Fleming <mdf356@gmail.com> Cc: KOT MATPOCKuH <matpockuh@gmail.com>, FreeBSD Current <freebsd-current@freebsd.org>, Peter Jeremy <peterjeremy@acm.org> Subject: Re: [zfs] Mounting from (...) failed with error 19 Message-ID: <AANLkTimg5excPh9c8vdqaywEaL8cYsBqhNqryPQjoFF8@mail.gmail.com> In-Reply-To: <AANLkTi=0=LeZhwvsY-==OF5ZgH2pGvgoionfVODOMoWb@mail.gmail.com> References: <4CBCDD3A.9070404@delphij.net> <4CBD26B4.2020205@yandex.ru> <4CBDB17C.4040607@yandex.ru> <AANLkTimhCU%2BppQncCNJicH1AjuM25Z6GH3Jmqckprn=H@mail.gmail.com> <20101020194547.GA94244@server.vk2pj.dyndns.org> <AANLkTino7DLY2Cj%2BnAsR1rM9KMEPvoSSxrqqyNDX9jLj@mail.gmail.com> <AANLkTi=0=LeZhwvsY-==OF5ZgH2pGvgoionfVODOMoWb@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 20, 2010 at 3:18 PM, Matthew Fleming <mdf356@gmail.com> wrote: > On Wed, Oct 20, 2010 at 1:39 PM, Garrett Cooper <gcooper@freebsd.org> wro= te: >> On Wed, Oct 20, 2010 at 12:45 PM, Peter Jeremy <peterjeremy@acm.org> wro= te: >>> On 2010-Oct-20 10:50:38 +0400, KOT MATPOCKuH <matpockuh@gmail.com> wrot= e: >>>>> I fixed it with attached patch. >>>>Omg... Why You are using strcmp, but not strncmp(fs, "zfs", strlen("zfs= "))? >>> >>> Can you explain why you think it should be strncmp() please. >> >> I'd say that strcmp is perfectly fine because zfs is a 3 character (4 >> if you count NUL) string. The comparison logic is dang near the same: > > It wouldn't be about the length of the string, but whether you want a > match on other strings like "zfs2", "zfs_foo", and anything else > prefixed with zfs. =A0That's the difference between strcmp and > strncmp(... strlen()). Well, yeah... the because using the above strategy would introduce parsing bugs as you so elegantly put it :). -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimg5excPh9c8vdqaywEaL8cYsBqhNqryPQjoFF8>