Everything else in nbd-server was already 64bit-clean, but this part,
where the size of a block device is autodected, wasn't.
Replace the ioctl() to BLKGETSIZE with its 64bit version, so that trying
to detect the size of a multi-terabyte block device does not fail.
**/
off_t size_autodetect(int fhandle) {
off_t es;
**/
off_t size_autodetect(int fhandle) {
off_t es;
struct stat stat_buf;
int error;
#ifdef HAVE_SYS_MOUNT_H
#ifdef HAVE_SYS_IOCTL_H
struct stat stat_buf;
int error;
#ifdef HAVE_SYS_MOUNT_H
#ifdef HAVE_SYS_IOCTL_H
-#ifdef BLKGETSIZE
- DEBUG("looking for export size with ioctl BLKGETSIZE\n");
- if (!ioctl(fhandle, BLKGETSIZE, §ors) && sectors) {
- es = (off_t)sectors * (off_t)512;
- return es;
+#ifdef BLKGETSIZE64
+ DEBUG("looking for export size with ioctl BLKGETSIZE64\n");
+ if (!ioctl(fhandle, BLKGETSIZE64, bytes) && bytes) {
+ return (off_t)bytes;
+#endif /* BLKGETSIZE64 */
#endif /* HAVE_SYS_IOCTL_H */
#endif /* HAVE_SYS_MOUNT_H */
#endif /* HAVE_SYS_IOCTL_H */
#endif /* HAVE_SYS_MOUNT_H */