Wouter Verhelst <[email protected]> writes:
>> $ nbd-server 2000 /dev/md0 3000614518784
>> $ nc localhost 2000|hexdump -C
>> 00000000 4e 42 44 4d 41 47 49 43 00 00 42 02 81 86 12 53
>> |NBDMAGIC..B....S|
>> 00000010 00 00 00 ba a2 90 00 00 00 00 00 01 00 00 00 00
>> |................|
>
> ... except it doesn't.
The reason seems to be that nbd-server uses atol() which does not handle
such large numbers.
> es = (off_t)atol(optarg);
> switch (suffix) {
> case 'm':
> case 'M': es <<= 10;
> case 'k':
> case 'K': es <<= 10;
> default : break;
> }
> serve->expected_size = es;
It should use atoll() instead.
$ gcc-e 'printf("0x%016lx\n", atol("3000614518784"));'
0x000000007fffffff
$ gcc-e 'printf("0x%016llx\n", atoll("3000614518784"));'
0x000002baa2900000
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]