Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:43 -0000
From:      Ian Lepore <ian@freebsd.org>
To:        Bruce Evans <brde@optusnet.com.au>, Ed Maste <emaste@freebsd.org>
Cc:        "Rodney W. Grimes" <rgrimes@freebsd.org>, Xin LI <delphij@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r345900 - head/sbin/fsck_msdosfs
Message-ID:  <75f6609a7c532df05a4a18442f4e14708b788f28.camel@freebsd.org>
In-Reply-To: <20190406014249.N4174@besplex.bde.org>
References:  <201904050221.x352LGjU015040@repo.freebsd.org> <201904050449.x354nUEC036896@gndrsh.dnsmgr.net> <CAPyFy2C3KXTB7EKnp1PJigjUXY3xB_%2BPUddi43hjp5oKpZP56w@mail.gmail.com> <20190406014249.N4174@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 2019-04-06 at 01:47 +1100, Bruce Evans wrote:
> On Fri, 5 Apr 2019, Ed Maste wrote:
> 
> > On Fri, 5 Apr 2019 at 00:49, Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net> wrote:
> >>
> >
> >>> +static const u_char dot_name[] = {
> >>> +     '.', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
> >>> +static const u_char dotdot_name[] = {
> >>> +     '.', '.',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
> >>> +
> >>
> >> Does it make since to encode these as hex or octal constants,
> >> one can not tell that those are different values in an easy
> >> manner.  They all look like '.' in the diff, and probably
> >> in most editors.
> 
> No, but it makes sense to write them as string constants.  They are just
> the strings "." and ".." padded with spaces to length 11, except they
> are not actually strings since they are not NUL terminated.  11 is for
> 8+3 msdos short file names.  These are not NUL terminated either, but
> it should be easy to ignore the extra NUL given by the string constants.
> 

Defining them as nulterminated strings will also affect
sizeof(dot_name), better make sure nothing relies on that.

-- Ian







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?75f6609a7c532df05a4a18442f4e14708b788f28.camel>