[PATCH 1/4] printertask.c: Fix Unchecked return value (CID #1399710)

Ryan Long thisisryanlong at gmail.com
Fri Feb 26 21:34:44 UTC 2021


CID 1399710: Unchecked return value in printer_task().
CID 1472764: Unchecked return value in rtems_print_printer_task().

Closes #4258
---
 cpukit/libcsupport/src/printertask.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cpukit/libcsupport/src/printertask.c b/cpukit/libcsupport/src/printertask.c
index bae623b..bca90a1 100644
--- a/cpukit/libcsupport/src/printertask.c
+++ b/cpukit/libcsupport/src/printertask.c
@@ -117,6 +117,7 @@ static void printer_task( rtems_task_argument arg )
 {
   rtems_printer_task_context *ctx;
   int                         fd;
+  rtems_status_code           sc;
 
   ctx = (rtems_printer_task_context *) arg;
   fd = ctx->fd;
@@ -141,8 +142,9 @@ static void printer_task( rtems_task_argument arg )
           printer_task_append_buffer( ctx, &ctx->free_buffers, buffer );
           break;
         case ACTION_DRAIN:
-          fsync(fd);
-          rtems_event_transient_send( buffer->action_data.task );
+          (void)fsync(fd);
+          sc = rtems_event_transient_send( buffer->action_data.task );
+          _Assert_Unused_variable_equals(sc, RTEMS_SUCCESSFUL);
           break;
       }
     }
@@ -185,7 +187,8 @@ int rtems_print_printer_task(
   printer->context = ctx;
   printer->printer = printer_task_printer;
 
-  rtems_task_start( ctx->task, printer_task, (rtems_task_argument) ctx );
+  sc = rtems_task_start( ctx->task, printer_task, (rtems_task_argument) ctx );
+  _Assert_Unused_variable_equals(sc, RTEMS_SUCCESSFUL);
 
   return 0;
 }
-- 
1.8.3.1



More information about the devel mailing list