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

Gedare Bloom gedare at rtems.org
Fri Feb 26 21:55:05 UTC 2021


On Fri, Feb 26, 2021 at 2:34 PM Ryan Long <thisisryanlong at gmail.com> wrote:
>
> 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);
why not  above
int err;
and here
err = fsync(fd);
_Assert_Unused_variable_equals(err, 0);
?

> +          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
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list