[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stat signed/unsigned
From: |
Jim Meyering |
Subject: |
Re: stat signed/unsigned |
Date: |
Fri, 02 Jan 2009 17:08:43 +0100 |
Michael Meskes <address@hidden> wrote:
> On Wed, Dec 31, 2008 at 03:18:44PM +0100, Jim Meyering wrote:
>> Thanks, but "man statfs" on linux-based systems shows it can be signed:
>> ...
>
> Sorry for the noise, I just used grep -r to find stuff like
>
> /usr/include/asm-generic/statfs.h: __u32 f_files;
> /usr/include/asm-generic/statfs.h: __u64 f_files;
> /usr/include/asm-generic/statfs.h: __u64 f_files;
Have you seen ever stat print a negative number
corresponding to that field? Actually, I'll bet that
*has* happened... and considering the semantics
of that variable, I see no reason to print a signed value.
So this patch has your name/email on it.
Tell me those are ok and I'll push it.
Thanks!
>From 907e1af5ddbfc208ab5a2f88da48a5c86340b183 Mon Sep 17 00:00:00 2001
From: Michael Meskes <address@hidden>
Date: Fri, 2 Jan 2009 16:40:52 +0100
Subject: [PATCH] stat: print file-system total inode count (%c) as an unsigned
number
* src/stat.c (print_statfs): Print statfs.f_files, the total inode
count of a file system, as an unsigned number.
---
src/stat.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/stat.c b/src/stat.c
index f5bf8cd..feea4b7 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -1,5 +1,5 @@
/* stat.c -- display file or file system status
- Copyright (C) 2001-2008 Free Software Foundation, Inc.
+ Copyright (C) 2001-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -541,7 +541,7 @@ print_statfs (char *pformat, size_t prefix_len, char m,
char const *filename,
}
break;
case 'c':
- out_int (pformat, prefix_len, statfsbuf->f_files);
+ out_uint (pformat, prefix_len, statfsbuf->f_files);
break;
case 'd':
out_int (pformat, prefix_len, statfsbuf->f_ffree);
--
1.6.1.302.gccd4d
- Re: stat signed/unsigned, Michael Meskes, 2009/01/02
- Re: stat signed/unsigned,
Jim Meyering <=
- Re: stat signed/unsigned, Michael Meskes, 2009/01/02
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/06
- Re: stat signed/unsigned, Jim Meyering, 2009/01/06
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/06
- Re: stat signed/unsigned, Jim Meyering, 2009/01/06
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/07
- Re: stat signed/unsigned, Paul Eggert, 2009/01/08
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/09
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/15
- Re: stat signed/unsigned, Jim Meyering, 2009/01/16