The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: msdos_format_name() bug?
Date: Tue, 03 Feb 2009 01:09:24 +0900	[thread overview]
Message-ID: <87iqnsq0qz.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <4987030D.1070907@gmail.com> (Roel Kluin's message of "Mon, 02 Feb 2009 15:28:29 +0100")

Roel Kluin <roel.kluin@gmail.com> writes:

> in msdos_format_name(const unsigned char *name, int len, ...)
>
> name is the proposed name, len is its length.
>
>         while (c != '.' && len--)
>                 c = *name++;
>         if (c == '.') {
>                 while (walk - res < 8)
>                         *walk++ = ' ';
>                 while (len > 0 && walk - res < MSDOS_NAME) {
>
> Is the postfix decrement in the first loop correct, or should it be
> prefix? (isn't that one character too many?)
>
> If not, note that if the proposed name ends with a dot: e.g.
> 'myfile.' the first while loop iterates until the dot which ends
> the loop, but because of the postfix decrement len already is 0,
> so the third while loop won't start. Is that correct?

In the "myfile." case, it seems correct. It will provide "MYFILE     ".
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

      reply	other threads:[~2009-02-02 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02 14:28 msdos_format_name() bug? Roel Kluin
2009-02-02 16:09 ` OGAWA Hirofumi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iqnsq0qz.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox