rpms/mc/devel mc-64bit.patch,NONE,1.1 mc.spec,1.52,1.53

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Apr 4 07:29:31 UTC 2005


Update of /cvs/dist/rpms/mc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19777

Modified Files:
	mc.spec 
Added Files:
	mc-64bit.patch 
Log Message:

- fix truncation to lower 32bits in statfs (src/mountlist.c)



mc-64bit.patch:
 acinclude.m4    |    2 +-
 src/mountlist.c |   25 ++++++++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

--- NEW FILE mc-64bit.patch ---
--- mc-4.6.1-20041020/src/mountlist.c.64bit	2004-09-25 15:46:23.000000000 +0200
+++ mc-4.6.1-20041020/src/mountlist.c	2005-04-01 16:20:27.192132368 +0200
@@ -132,11 +132,19 @@ struct mount_entry
 
 struct fs_usage
 {
+#ifndef HAVE_SYS_STATVFS_H
   long fsu_blocks;		/* Total blocks. */
   long fsu_bfree;		/* Free blocks available to superuser. */
   long fsu_bavail;		/* Free blocks available to non-superuser. */
   long fsu_files;		/* Total file nodes. */
   long fsu_ffree;		/* Free file nodes. */
+#else	/* We have sys/statvfs.h, use proper data types when _FILE_OFFSET_BITS=64 */
+  fsblkcnt_t fsu_blocks;
+  fsblkcnt_t fsu_bfree;
+  fsblkcnt_t fsu_bavail;
+  fsblkcnt_t fsu_files;
+  fsblkcnt_t fsu_ffree;
+#endif /* HAVE_SYS_STATVFS_H */
 };
 
 static int get_fs_usage (char *path, struct fs_usage *fsp);
@@ -663,6 +671,7 @@ my_statfs (struct my_statfs *myfs_stats,
    BLOCKS FROMSIZE-byte blocks, rounding away from zero.
    TOSIZE must be positive.  Return -1 if FROMSIZE is not positive.  */
 
+#if !defined(HAVE_SYS_STATFS_H) || !defined(STAT_STATVFS)
 static long
 fs_adjust_blocks (long blocks, int fromsize, int tosize)
 {
@@ -670,13 +679,21 @@ fs_adjust_blocks (long blocks, int froms
 	abort ();
     if (fromsize <= 0)
 	return -1;
-
+#else
+static fsblkcnt_t
+fs_adjust_blocks (fsblkcnt_t blocks, unsigned long fromsize, unsigned long tosize)
+{
+    if (!tosize)
+        abort ();
+    if (!fromsize)
+        return -1;
+#endif
     if (fromsize == tosize)	/* E.g., from 512 to 512.  */
 	return blocks;
     else if (fromsize > tosize)	/* E.g., from 2048 to 512.  */
 	return blocks * (fromsize / tosize);
     else			/* E.g., from 256 to 512.  */
-	return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
+	return (blocks + 1) / (tosize / fromsize);
 }
 
 #if defined(_AIX) && defined(_I386)
@@ -773,9 +790,7 @@ get_fs_usage (char *path, struct fs_usag
 
     if (statvfs (path, &fsd) < 0)
 	return -1;
-    /* f_frsize isn't guaranteed to be supported.  */
-#define CONVERT_BLOCKS(b) \
-  fs_adjust_blocks ((b), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
+#define CONVERT_BLOCKS(b) fs_adjust_blocks ((b), fsd.f_frsize, 512)
 #endif
 
 #if defined(CONVERT_BLOCKS) && !defined(STAT_STATFS2_FS_DATA) && !defined(STAT_READ_FILSYS)	/* !Ultrix && !SVR2.  */
--- mc-4.6.1-20041020/acinclude.m4.64bit	2005-04-01 16:15:56.453290928 +0200
+++ mc-4.6.1-20041020/acinclude.m4	2005-04-01 16:15:56.525279984 +0200
@@ -501,7 +501,7 @@ dnl job is to detect a method to get fil
       if test $ac_cv_func_statvfs = yes; then
 	space=yes
 	AC_DEFINE(STAT_STATVFS, 1,
-		  [Define if function `statfs' can be used])
+		  [Define if function `statvfs' can be used])
       fi
     fi
 


Index: mc.spec
===================================================================
RCS file: /cvs/dist/rpms/mc/devel/mc.spec,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- mc.spec	24 Mar 2005 14:34:59 -0000	1.52
+++ mc.spec	4 Apr 2005 07:29:29 -0000	1.53
@@ -1,7 +1,7 @@
 Summary:	User-friendly text console file manager and visual shell.
 Name:		mc
 Version:	4.6.1a
-Release:	0.7
+Release:	0.8
 Epoch:		1
 License:	GPL
 Group:		System Environment/Shells
@@ -21,6 +21,7 @@
 Patch4:		mc-fish-upload.patch
 Patch5:		mc-spaceprompt.patch
 Patch6:		mc-userhost.patch
+Patch7:		mc-64bit.patch
 
 %description
 Midnight Commander is a visual shell much like a file manager, only
@@ -39,6 +40,7 @@
 %patch4 -p1 -b .fish-upload
 %patch5 -p1 -b .spaceprompt
 %patch6 -p1 -b .userhost
+%patch7 -p1 -b .64bit
 
 # convert files in /lib to UTF-8
 pushd lib
@@ -172,6 +174,9 @@
 %dir %{_datadir}/mc
 
 %changelog
+* Mon Apr 04 2005 Jindrich Novy <jnovy at redhat.com> 4.6.1a-0.8
+- fix truncation to lower 32bits in statfs (src/mountlist.c)
+
 * Thu Mar 24 2005 Jindrich Novy <jnovy at redhat.com> 4.6.1a-0.7
 - update from CVS
 - sync with .utf8 patch




More information about the fedora-cvs-commits mailing list