reverting to the behavior in coreutils-9.0 and earlier.
This behavior is now documented.
+ ’stat -c %s' now prints sizes as unsigned, consistent with 'ls'.
+
** New Features
factor now accepts the --exponents (-h) option to print factors
}
#endif /* USE_STATX */
+/* POSIX requires 'ls' to print file sizes without a sign, even
+ when negative. Be consistent with that. */
+
+static uintmax_t
+unsigned_file_size (off_t size)
+{
+ return size + (size < 0) * ((uintmax_t) OFF_T_MAX - OFF_T_MIN + 1);
+}
/* Print stat info. Return zero upon success, nonzero upon failure. */
static bool
fail |= out_mount_point (filename, pformat, prefix_len, statbuf);
break;
case 's':
- out_int (pformat, prefix_len, statbuf->st_size);
+ out_uint (pformat, prefix_len, unsigned_file_size (statbuf->st_size));
break;
case 'r':
if (mod == 'H')