Skip to content

Commit 69f4d01

Browse files
committed
iiod-client: errors are negative, so print them that way
printf("zu") is for unsigned size_t, not ssize_t (which is signed) Since all error codes are negative - the current code prints out a unsigned version, which is wrong. This fixes that. Signed-off-by: Robin Getz <[email protected]>
1 parent 5f5af2e commit 69f4d01

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

iiod-client.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static ssize_t iiod_client_read_integer(struct iiod_client *client,
4444
ret = client->ops->read_line(client->pdata,
4545
desc, buf, sizeof(buf));
4646
if (ret < 0) {
47-
ERROR("READ LINE: %zu\n", ret);
47+
ERROR("READ LINE: %zd\n", ret);
4848
return ret;
4949
}
5050

@@ -571,7 +571,7 @@ static int iiod_client_read_mask(struct iiod_client *client,
571571

572572
ret = iiod_client_read_all(client, desc, buf, words * 8 + 1);
573573
if (ret < 0) {
574-
ERROR("READ ALL: %zu\n", ret);
574+
ERROR("READ ALL: %zd\n", ret);
575575
goto out_buf_free;
576576
} else
577577
ret = 0;
@@ -610,7 +610,7 @@ ssize_t iiod_client_read_unlocked(struct iiod_client *client, void *desc,
610610

611611
ret = iiod_client_write_all(client, desc, buf, strlen(buf));
612612
if (ret < 0) {
613-
ERROR("WRITE ALL: %zu\n", ret);
613+
ERROR("WRITE ALL: %zd\n", ret);
614614
return ret;
615615
}
616616

@@ -619,7 +619,7 @@ ssize_t iiod_client_read_unlocked(struct iiod_client *client, void *desc,
619619

620620
ret = iiod_client_read_integer(client, desc, &to_read);
621621
if (ret < 0) {
622-
ERROR("READ INTEGER: %zu\n", ret);
622+
ERROR("READ INTEGER: %zd\n", ret);
623623
return ret;
624624
}
625625
if (to_read < 0)
@@ -630,7 +630,7 @@ ssize_t iiod_client_read_unlocked(struct iiod_client *client, void *desc,
630630
if (mask) {
631631
ret = iiod_client_read_mask(client, desc, mask, words);
632632
if (ret < 0) {
633-
ERROR("READ ALL: %zu\n", ret);
633+
ERROR("READ ALL: %zd\n", ret);
634634
return ret;
635635
}
636636

0 commit comments

Comments
 (0)