Module: xenomai-abe
Branch: analogy
Commit: 0584265f069be4447cdb853062b095b0c3889627
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=0584265f069be4447cdb853062b095b0c3889627

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Sun Mar 14 01:25:51 2010 +0100

analogy: fix a bug in cmd_read with real-time mode enabled

The count of read bytes was overwritten by the results of the call to
rt_task_set_mode().

---

 src/utils/analogy/cmd_read.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/utils/analogy/cmd_read.c b/src/utils/analogy/cmd_read.c
index 1562a21..32d3db0 100644
--- a/src/utils/analogy/cmd_read.c
+++ b/src/utils/analogy/cmd_read.c
@@ -410,14 +410,16 @@ int main(int argc, char *argv[])
                        cnt += ret;
 
                        if (real_time != 0) {
-                               ret = rt_task_set_mode(0, T_PRIMARY, NULL);
-                               if (ret < 0) {
+                               int err = rt_task_set_mode(0, T_PRIMARY, NULL);
+                               if (err < 0) {
                                        fprintf(stderr,
                                                "cmd_read: rt_task_set_mode 
failed (ret=%d)\n",
-                                               ret);
+                                               err);
+                                       ret = err;
                                        goto out_main;
                                }
                        }
+
                } while (ret > 0);
 
        } else {
@@ -465,11 +467,12 @@ int main(int argc, char *argv[])
                        }
 
                        if (real_time != 0) {
-                               ret = rt_task_set_mode(0, T_PRIMARY, NULL);
-                               if (ret < 0) {
+                               int err = rt_task_set_mode(0, T_PRIMARY, NULL);
+                               if (err < 0) {
                                        fprintf(stderr,
                                                "cmd_read: rt_task_set_mode 
failed (ret=%d)\n",
-                                               ret);
+                                               err);
+                                       ret = err;
                                        goto out_main;
                                }
                        }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to