Unify and fixup error handling
[fio.git] / engines / libaio.c
index ba8c49df6583ddf7051e215f9da46c968d3b34aa..cb488efb1b5acbbd524bbc25914f40b86ea772e7 100644 (file)
@@ -62,10 +62,7 @@ static int fio_libaio_getevents(struct thread_data *td, int min, int max,
                        break;
        } while (1);
 
-       if (r < 0)
-               r = -r;
-
-       return (int) r;
+       return r;
 }
 
 static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
@@ -91,7 +88,7 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
                         * requests to flush first.
                         */
                        if (fsync(io_u->file->fd) < 0)
-                               ret = errno;
+                               ret = -errno;
                        else
                                ret = FIO_Q_COMPLETED;
                        break;