Check return of write
gcc on Linux warns when the return value of write is not checked.pull/225/head
parent
5a0c1bdc26
commit
36f9a46318
|
@ -46,6 +46,8 @@ int main(int argc, char *argv[])
|
||||||
uint32_t qxlen = POINT_SIZE, qylen = POINT_SIZE;
|
uint32_t qxlen = POINT_SIZE, qylen = POINT_SIZE;
|
||||||
word32 idx = 0;
|
word32 idx = 0;
|
||||||
ecc_key ec;
|
ecc_key ec;
|
||||||
|
uint32_t len;
|
||||||
|
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
fprintf(stderr, "Usage: %s der_key_file raw_key_file\n", argv[0]);
|
fprintf(stderr, "Usage: %s der_key_file raw_key_file\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -77,8 +79,16 @@ int main(int argc, char *argv[])
|
||||||
perror("opening output file");
|
perror("opening output file");
|
||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
write(fd_out, Qx, qxlen);
|
len = (uint32_t)write(fd_out, Qx, qxlen);
|
||||||
write(fd_out, Qy, qylen);
|
if (len != qxlen) {
|
||||||
|
perror("write Qx - short");
|
||||||
|
exit(6);
|
||||||
|
}
|
||||||
|
len = write(fd_out, Qy, qylen);
|
||||||
|
if (len != qylen) {
|
||||||
|
perror("write Qy - short");
|
||||||
|
exit(7);
|
||||||
|
}
|
||||||
close(fd_out);
|
close(fd_out);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue