From: Jason Rumney Date: Wed, 27 Nov 2002 23:51:02 +0000 (+0000) Subject: (Ffile_attributes): Don't return negative file sizes for X-Git-Tag: ttn-vms-21-2-B4~12254 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4bc12672406fab145035c2c24fc0cac8caf5844b;p=emacs.git (Ffile_attributes): Don't return negative file sizes for files bigger than 2Gb when off_t is 32 bit. --- diff --git a/src/dired.c b/src/dired.c index 692d193c5ae..7b8a3dca552 100644 --- a/src/dired.c +++ b/src/dired.c @@ -940,6 +940,11 @@ If file does not exist, returns nil. */) /* 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 */