Package: util-linux
Version: 2.11z
Author: Guillem Jover <guillem@hadrons.org>
Status: applied
Description:
 Reverted bad change introduced with the Debian GNU/Hurd porting patch.

diff -Naur util-linux-2.11z/configure util-linux-2.11z-patched/configure
--- util-linux-2.11z/configure	2003-08-19 11:57:49.000000000 +0200
+++ util-linux-2.11z-patched/configure	2003-08-19 12:00:25.000000000 +0200
@@ -40,7 +40,6 @@
 # 12. For hwclock.c: does struct tm have a field tm_gmtoff?
 # 13. For nfsmount: does the output of rpcgen compile?
 # 14. For fsck.cramfs, mkfs.cramfs: do we have libz?
-# 15. For lib/get_blocks.c: does struct stat have a field st_blocks?
 
 rm -f make_include defines.h
 
@@ -705,27 +704,3 @@
 fi
 rm -f conftest conftest.c
 
-#
-# 15. For lib/get_blocks.c: does struct stat have a field st_blocks?
-#
-echo "
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-int main()
-{
-    struct stat st;
-    fstat(0, &st);
-    st.st_blocks = 0;
-    return 0;
-}
-" >conftest.c
-eval $compile
-if test -s conftest; then
-        echo "#define HAVE_st_blocks" >> defines.h
-        echo "You have a st_blocks field in struct stat"
-else
-        echo "You don't have a st_blocks field in struct stat"
-fi
-rm -f conftest conftest.c
-
diff -Naur util-linux-2.11z/lib/get_blocks.c util-linux-2.11z-patched/lib/get_blocks.c
--- util-linux-2.11z/lib/get_blocks.c	2003-08-19 11:57:49.000000000 +0200
+++ util-linux-2.11z-patched/lib/get_blocks.c	2003-08-19 11:59:27.000000000 +0200
@@ -16,9 +16,7 @@
 #include "../defines.h"
 #include "get_blocks.h"
 #include <sys/types.h>
-#ifdef HAVE_st_blocks
 #include <sys/stat.h>
-#endif
 #include <unistd.h>
 
 #ifdef __linux__
@@ -73,6 +71,8 @@
 unsigned long
 get_blocks (int fd)
 {
+	struct stat	st;
+
 #ifdef __linux__
 	{
 		unsigned long	blocks;
@@ -80,13 +80,10 @@
 			return blocks;
 	}
 #endif /*  __linux__ */
-#ifdef HAVE_st_blocks
-	{
-		struct stat	st;
-		if (fstat(fd, &st) == 0)
-			return st.st_blocks;
-	}
-#endif
+
+	if (fstat(fd, &st) == 0)
+		return st.st_size / 512;
+
 	return count_blocks(fd);
 }
 
