Introduce pwarnf() for better diagnosis of socket/fd write issues.#554
Merged
jnovy merged 1 commit intocontainers:mainfrom Apr 24, 2025
Merged
Introduce pwarnf() for better diagnosis of socket/fd write issues.#554jnovy merged 1 commit intocontainers:mainfrom
jnovy merged 1 commit intocontainers:mainfrom
Conversation
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/utils.h:98
- [nitpick] The syslog message in the pwarnf() macro uses '' which is inconsistent with the pwarnf() naming; consider updating it to '' or another consistent label.
syslog(LOG_INFO, "conmon %.20s <nwarn>: " fmt ": %s\n", log_cid, ##__VA_ARGS__, strerror(errno));
kolyshkin
requested changes
Apr 22, 2025
Collaborator
There was a problem hiding this comment.
Frankly,
- since we already have
#define _GNU_SOURCEin the code, I'd rather use nwarnf with added%m; - it's probably cleaner to use a ternary operator to add fd/socket to the message.
IOW something like this (untested):
...
if (w < 0) {
pwarnf("Failed to write to %s %s: %m",
local_sock->is_stream ? "fd" : "label",
local_sock->label);
} else {
...Finally, can ditch pwarn, replacing it with nwarnf(... ": %m") (but this is out of scope for this PR).
Related: containers#540 Signed-off-by: Jindrich Novy <jnovy@redhat.com>
Collaborator
|
Opened #556 as an alternative to this one. |
Collaborator
Author
|
Merging this one as following PRs are dependent on existence of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #540