Fixed errno usage in user library.
--- a/lib/master.c Tue Apr 27 10:13:31 2010 +0200
+++ b/lib/master.c Tue Apr 27 10:30:24 2010 +0200
@@ -264,10 +264,8 @@
download.data = data;
if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, &download) == -1) {
- if (errno == -EIO) {
- if (abort_code) {
- *abort_code = download.abort_code;
- }
+ if (errno == EIO && abort_code) {
+ *abort_code = download.abort_code;
}
fprintf(stderr, "Failed to execute SDO download: %s\n",
strerror(errno));
@@ -292,10 +290,8 @@
upload.target = target;
if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_UPLOAD, &upload) == -1) {
- if (errno == -EIO) {
- if (abort_code) {
- *abort_code = upload.abort_code;
- }
+ if (errno == EIO && abort_code) {
+ *abort_code = upload.abort_code;
}
fprintf(stderr, "Failed to execute SDO upload: %s\n",
strerror(errno));