Fixed errno usage in user library.
authorFlorian Pose <fp@igh-essen.com>
Tue, 27 Apr 2010 10:30:24 +0200
changeset 1911 460baca4df83
parent 1910 9a741a3d01bb
child 1912 d480e0439664
Fixed errno usage in user library.
lib/master.c
--- 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));