Date: Tue, 09 Jan 2018 17:17:49 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 224845] Change return type to size_t. Message-ID: <bug-224845-8-cJKVZFnqVa@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-224845-8@https.bugs.freebsd.org/bugzilla/> References: <bug-224845-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224845 Mitchell Horne <mhorne063@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mhorne063@gmail.com --- Comment #1 from Mitchell Horne <mhorne063@gmail.com> --- (In reply to Bulat from comment #0) What appears different between the FreeBSD and OpenBSD implementations of d= d is that FreeBSD supports the 't' (tera) and 'p' (peta) file size options on the command line. So on systems where size_t is implemented as 32 bits, some information would be lost if the user were to input a large file size. By=20 using uintmax_t, it (almost) guarantees that the entirety of the user's inp= ut size is captured, as uintmax_t is at least 64 bits wide. In the case that t= he largest possible file size is smaller than the user's input, SIZE_MAX is us= ed instead. An example: The user inputs "1t" as a file size on a system where size_t is 32-bits wide. The value 1 is taken and bit shifted 40 times (1TB =3D 2^40 b= ytes), and the 32 bit value of size_t is filled with only zeros, resulting in a 0 = byte output file or an error. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224845-8-cJKVZFnqVa>