Skip to content

libct/nsenter: fix unused-result warning#3168

Merged
AkihiroSuda merged 1 commit intoopencontainers:masterfrom
kolyshkin:fix-cc-warn
Aug 18, 2021
Merged

libct/nsenter: fix unused-result warning#3168
AkihiroSuda merged 1 commit intoopencontainers:masterfrom
kolyshkin:fix-cc-warn

Conversation

@kolyshkin
Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin commented Aug 17, 2021

This is an alternative to #3165 / #3154.

Commit 2bab4a5 resulted in a warning from gcc:

nsexec.c: In function ‘write_log’:
nsexec.c:171:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  171 |  write(logfd, json, ret);
      |  ^~~~~~~~~~~~~~~~~~~~~~~

As there's nothing we can or want to do in case write fails,
let's just tell the compiler we're not going to use it.

Fixes: 2bab4a5

1.0 backport: #3169

Commit 2bab4a5 resulted in a warning from gcc:

	nsexec.c: In function ‘write_log’:
	nsexec.c:171:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
	  171 |  write(logfd, json, ret);
	      |  ^~~~~~~~~~~~~~~~~~~~~~~

As there's nothing we can or want to do in case write fails,
let's just tell the compiler we're not going to use it.

Fixes: 2bab4a5
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin added this to the 1.1.0 milestone Aug 17, 2021
@kolyshkin kolyshkin added area/nsenter backport/1.0-todo A PR in main branch which needs to be backported to release-1.0 easy-to-review labels Aug 17, 2021
@AkihiroSuda AkihiroSuda merged commit ba7a877 into opencontainers:master Aug 18, 2021
@kolyshkin kolyshkin added backport/1.0-done A PR in main branch which has been backported to release-1.0 and removed backport/1.0-todo A PR in main branch which needs to be backported to release-1.0 labels Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/nsenter backport/1.0-done A PR in main branch which has been backported to release-1.0 easy-to-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants