changeset 48563:26e19e854ef3

(Ffile_attributes): Don't return negative file sizes for files bigger than 2Gb when off_t is 32 bit.
author Jason Rumney <jasonr@gnu.org>
date Wed, 27 Nov 2002 23:51:02 +0000
parents b3e8e8c5face
children 7f44fb167662
files src/dired.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dired.c	Wed Nov 27 23:50:54 2002 +0000
+++ b/src/dired.c	Wed Nov 27 23:51:02 2002 +0000
@@ -940,6 +940,11 @@
   /* If the size is out of range for an integer, return a float.  */
   if (XINT (values[7]) != s.st_size)
     values[7] = make_float ((double)s.st_size);
+  /* If the size is negative, and its type is long, convert it back to
+     positive.  */
+  if (s.st_size < 0 && sizeof (s.st_size) == sizeof (long))
+    values[7] = make_float ((double) ((unsigned long) s.st_size));
+
   filemodestring (&s, modes);
   values[8] = make_string (modes, 10);
 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */