lkml.org 
[lkml]   [2009]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: msdos_format_name() bug?
Date
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>


\
 
 \ /
  Last update: 2009-02-02 17:11    [from the cache]
©2003-2011 Jasper Spaans