bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coreutils 'stat' uses wrong statfs signature on Solaris 8


From: Paul Eggert
Subject: coreutils 'stat' uses wrong statfs signature on Solaris 8
Date: Sat, 27 Mar 2004 21:45:55 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

The coreutils 'stat' command invokes 'statfs (filename, &statfsbuf)',
but on Solaris 8 the statfs function takes 4 arguments, not 2, and the
arguments are of different types.  I assume that this leads to bogus
results though I haven't tested it.

In the long run, I suppose that 'stat' should be changed to call
get_fs_usage, which seems to be better-ported: it knows about
the Solaris way of invoking statfs.  This'd take some work, though.

In the short run, here's a simple preventive measure that will cause
'stat.c' to fail to compile on Solaris 8: this is bad but it is better
than undefined behavior at runtime.

2004-03-28  Paul Eggert  <address@hidden>

        * src/stat.c [HAVE_SYS_STATFS_H]: Include <sys/statfs.h>, for
        a statfs prototype on Solaris 8.        

Index: stat.c
===================================================================
RCS file: /home/meyering/coreutils/cu/src/stat.c,v
retrieving revision 1.66
diff -p -u -r1.66 stat.c
--- stat.c      5 Feb 2004 13:46:41 -0000       1.66
+++ stat.c      28 Mar 2004 00:57:24 -0000
@@ -42,6 +42,10 @@
 # endif
 #endif
 
+#if HAVE_SYS_STATFS_H
+# include <sys/statfs.h>
+#endif
+
 #include "system.h"
 
 #include "error.h"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]