delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/27/08:34:53

To: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Cc: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>,
DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Re: struct stat and st_blocks
In-Reply-To: <3E351138.4D0A67E5@phekda.freeserve.co.uk> (Richard Dawe's message of "Mon, 27 Jan 2003 11:00:08 +0000")
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1030127075631 DOT 11790A-100000 AT is>
<3E351138 DOT 4D0A67E5 AT phekda DOT freeserve DOT co DOT uk>
From: Jim Meyering <jim AT meyering DOT net>
Date: Mon, 27 Jan 2003 14:34:46 +0100
Message-ID: <85d6mik96x.fsf@pi.meyering.net>
Lines: 48
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019