remote_disk_server: Fix incorrect format size on 64-bit

* Of note, using the Linux version since this tool is
  generally compiled on the host system

Change-Id: I85907a09877a97ec6ec709add6f7985b551fcad3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7168
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Alexander von Gluck IV 2023-12-01 12:24:08 -06:00 committed by waddlesplash
parent c678ffc139
commit 6ce8dc888f

View File

@ -196,7 +196,7 @@ private:
int16_t size = ntohs(fRequest->size); int16_t size = ntohs(fRequest->size);
int16_t result = 0; int16_t result = 0;
printf("READ request: offset: %llu, %hd bytes\n", offset, size); printf("READ request: offset: %" PRIu64 ", %hd bytes\n", offset, size);
if (offset < (uint64_t)fImageSize && size > 0) { if (offset < (uint64_t)fImageSize && size > 0) {
// always read 1024 bytes // always read 1024 bytes
@ -212,12 +212,12 @@ private:
if (bytesRead >= 0) { if (bytesRead >= 0) {
result = bytesRead; result = bytesRead;
} else { } else {
fprintf(stderr, "Error: Failed to read at position %llu: " fprintf(stderr, "Error: Failed to read at position %" PRIu64 ": "
"%s.", offset, strerror(errno)); "%s.", offset, strerror(errno));
result = REMOTE_DISK_IO_ERROR; result = REMOTE_DISK_IO_ERROR;
} }
} else { } else {
fprintf(stderr, "Error: Failed to seek to position %llu: %s.", fprintf(stderr, "Error: Failed to seek to position %" PRIu64 ": %s.",
offset, strerror(errno)); offset, strerror(errno));
result = REMOTE_DISK_IO_ERROR; result = REMOTE_DISK_IO_ERROR;
} }
@ -239,7 +239,7 @@ private:
int16_t size = ntohs(fRequest->size); int16_t size = ntohs(fRequest->size);
int16_t result = 0; int16_t result = 0;
printf("WRITE request: offset: %llu, %hd bytes\n", offset, size); printf("WRITE request: offset: %" PRIu64 ", %hd bytes\n", offset, size);
if (size < 0 if (size < 0
|| (uint32_t)size > fRequestSize - sizeof(remote_disk_header) || (uint32_t)size > fRequestSize - sizeof(remote_disk_header)
@ -257,12 +257,12 @@ private:
if (bytesWritten >= 0) { if (bytesWritten >= 0) {
result = bytesWritten; result = bytesWritten;
} else { } else {
fprintf(stderr, "Error: Failed to write at position %llu: " fprintf(stderr, "Error: Failed to write at position %" PRIu64 ": "
"%s.", offset, strerror(errno)); "%s.", offset, strerror(errno));
result = REMOTE_DISK_IO_ERROR; result = REMOTE_DISK_IO_ERROR;
} }
} else { } else {
fprintf(stderr, "Error: Failed to seek to position %llu: %s.", fprintf(stderr, "Error: Failed to seek to position %" PRIu64 ": %s.",
offset, strerror(errno)); offset, strerror(errno));
result = REMOTE_DISK_IO_ERROR; result = REMOTE_DISK_IO_ERROR;
} }