Mail Archives: djgpp-workers/2003/01/27/08:34:53
Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk> wrote:
> Hello.
>
> Jim: struct stat on DJGPP does not contain st_blocks.
>
> Eli Zaretskii wrote:
> [snip]
>> > coreutils 4.5.4 uses st_blocks in the 'stat' program.
>>
>> What does `stat' do if st_blocks is not supported? Is the degradation in
>> functionality significant?
>
> It just reports the value of st_blocks.
>
> There is a configure-time check for the st_blocks and st_blksize members. If
> st_blocks isn't present, but st_blksize is, I was going to make it return
> st_size / st_blksize rounded up. If neither st_blocks nor st_blksize is
> present, then I'm not sure what we can do: I was going to make it return 0.
Hi Rich,
Thanks for reporting that!
I've just made the following change.
I'm not sure it's enough, but it may well be, since
that use of st_blocks in stat.c was the only one like it in
all of src/*.c.
* src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
Reported by Richard Dawe.
Index: stat.c
===================================================================
RCS file: /fetish/cu/src/stat.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -p -u -r1.34 -r1.35
--- stat.c 15 Dec 2002 20:45:57 -0000 1.34
+++ stat.c 27 Jan 2003 13:32:44 -0000 1.35
@@ -531,7 +531,7 @@ print_stat (char *pformat, char m, char
break;
case 'b':
strcat (pformat, "u");
- printf (pformat, (unsigned int) statbuf->st_blocks);
+ printf (pformat, (unsigned int) ST_NBLOCKS (*statbuf));
break;
case 'o':
strcat (pformat, "d");
- Raw text -