Menu

#87 Call to io_queue_init() in IOCQAIO.cpp ignores the error code return value

v1.0 (example)
open
nobody
None
5
2017-08-30
2017-08-30
No

The call to io_queue_init() in IOCQAIO.cpp is incorrect. This library routine returns -ERRNO. It does not set errno, as the call is written. The effect of this bug is that an incorrect error message is returned to the user if the call fails.

I wrote this patch to fix the problem:

# diff orig/iometer-1.1.0/src/IOCQAIO.cpp modified/iometer-1.1.0/src/IOCQAIO.cpp
129a130
>         int retval;
191,192c192,193
<         if (io_queue_init(size, &this_cqid->io_ctx_id) < 0) {
<           cout << "Error: cannot initialize aio completion queue: " << strerror(errno) << endl;
---
>         if ((retval=io_queue_init(size, &this_cqid->io_ctx_id)) < 0) {
>           cout << "Error: cannot initialize aio completion queue: " << strerror(-retval) << endl;

Discussion


Log in to post a comment.