[apparmor] [PATCH 3/5] Remove unused rc variable from pwarn

Steve Beattie steve at nxnw.org
Tue Jan 3 19:17:54 UTC 2012


On Tue, Dec 27, 2011 at 06:49:33PM -0800, John Johansen wrote:
> Signed-off-by: John Johansen <john.johansen at canonical.com>
> ---
>  parser/parser_common.c |   13 ++++++-------
>  1 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/parser/parser_common.c b/parser/parser_common.c
> index f409f87..59df46c 100644
> --- a/parser/parser_common.c
> +++ b/parser/parser_common.c
> @@ -54,17 +54,16 @@ void pwarn(char *fmt, ...)
>  {
>          va_list arg;
>          char *newfmt;
> -        int rc;
>  
>          if (conf_quiet || names_only || option == OPTION_REMOVE)
>                  return;
>  
> -        rc = asprintf(&newfmt, _("Warning from %s (%s%sline %d): %s"),
> -                      profilename ? profilename : "stdin",
> -                      current_filename ? current_filename : "",
> -                      current_filename ? " " : "",
> -                      current_lineno,
> -                      fmt);
> +        asprintf(&newfmt, _("Warning from %s (%s%sline %d): %s"),
> +		 profilename ? profilename : "stdin",
> +		 current_filename ? current_filename : "",
> +		 current_filename ? " " : "",
> +		 current_lineno,
> +		 fmt);
>          if (!newfmt)
>                  return;
>  

I suspect the reason the rc variable got added was to avoid the unused
result warning on the asprintf call that results:

  parser_common.c: In function ‘pwarn’:
  parser_common.c:61:17: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]


-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20120103/89a85026/attachment-0001.pgp>


More information about the AppArmor mailing list