mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libdasd: fix ioctl macro to return also positive return codes
In case of an error the ioctl macro only returns errno to the calling function. This misses positive returncodes from ioctls. Change the macro to also return positive return codes. Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
4e28047eb4
commit
3aa7f6e298
@@ -28,11 +28,13 @@
|
||||
|
||||
#define RUN_IOCTL(fd, req, argp) \
|
||||
do { \
|
||||
if (ioctl(fd, req, argp) != 0) { \
|
||||
int err = errno; \
|
||||
if (err != EBADF) \
|
||||
int rc = ioctl(fd, req, argp); \
|
||||
if (rc != 0) { \
|
||||
if (rc == -1) \
|
||||
rc = errno; \
|
||||
if (rc != EBADF) \
|
||||
dasd_close_device(fd); \
|
||||
return err; \
|
||||
return rc; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user