Skip to content

[1.0] libct/nsenter: fix unused-result warning#3169

Merged
mrunalp merged 1 commit intoopencontainers:release-1.0from
kolyshkin:1.0-fix-cc-warn
Aug 18, 2021
Merged

[1.0] libct/nsenter: fix unused-result warning#3169
mrunalp merged 1 commit intoopencontainers:release-1.0from
kolyshkin:1.0-fix-cc-warn

Conversation

@kolyshkin
Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin commented Aug 17, 2021

Backport of #3168 to release-1.0. Draft until that one is merged.

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
(cherry picked from commit db8330c)
Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

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>
(cherry picked from commit db8330c)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin marked this pull request as draft August 17, 2021 22:44
@kolyshkin kolyshkin mentioned this pull request Aug 17, 2021
@kolyshkin kolyshkin added this to the 1.0.2 milestone Aug 17, 2021
@AkihiroSuda AkihiroSuda marked this pull request as ready for review August 18, 2021 02:39
@mrunalp mrunalp merged commit 9c4d5c6 into opencontainers:release-1.0 Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants