[Heimdal-source-changes] [heimdal/heimdal] 785db7: Fix -O3 -Werror=unused-result build in dcache.c (#...

GitHub noreply at github.com
Tis Dec 25 07:29:26 CET 2018


  Branch: refs/heads/master
  Home:   https://github.com/heimdal/heimdal
  Commit: 785db7b74068ab8950c4eba56d72cd7d1009255d
      https://github.com/heimdal/heimdal/commit/785db7b74068ab8950c4eba56d72cd7d1009255d
  Author: Andrew Bartlett <abartlet at samba.org>
  Date:   2018-12-25 (Tue, 25 Dec 2018)

  Changed paths:
    M lib/krb5/dcache.c

  Log Message:
  -----------
  Fix -O3 -Werror=unused-result build in dcache.c (#420)

* Fix -O3 -Werror=unused-result build in dcache.c

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
with -O3 -Werror=unused-result

../lib/krb5/dcache.c:85:5: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
     asprintf(&path, "%s/primary-XXXXXX", dc->dir);
     ^
../lib/krb5/dcache.c: In function ‘primary_create’:
../lib/krb5/dcache.c:56:5: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
     asprintf(&primary, "%s/primary", dc->dir);
     ^
../lib/krb5/dcache.c: In function ‘dcc_gen_new’:
../lib/krb5/dcache.c:423:5: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
     asprintf(&name, ":%s/tktXXXXXX", dc->dir);
     ^
../lib/krb5/dcache.c: In function ‘dcc_resolve’:
../lib/krb5/dcache.c:340:2: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
  asprintf(&dc->name, ":%s/%s", dc->dir, residual);
  ^
../lib/krb5/dcache.c:348:5: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
     asprintf(&filename, "FILE%s", dc->name);
     ^
cc1: all warnings being treated as errors

Signed-off-by: Andrew Bartlett <abartlet at samba.org>

* Update dcache.c

When asprintf() fails it is not guaranteed that the output variable will be NULL on all platforms and releases.

* Update dcache.c



      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the Heimdal-source-changes mailing list