util: Downgrade ignored errors to warnings.

If the error is ignored it is not important enough - make it a warning
instead.

From: Mian Luo <mianl@google.com>
Change-Id: If2641c3d4e0a4d57fdf04e4570c49be55f526535
Signed-off-by: Michał Mirosław <emmir@google.com>
This commit is contained in:
Michał Mirosław 2023-06-22 17:31:57 +02:00 committed by Andrei Vagin
parent 2aa9cb9333
commit f2011e1c76
3 changed files with 10 additions and 8 deletions

View file

@ -440,12 +440,12 @@ lint:
shellcheck -x test/others/crit/*.sh test/others/criu-coredump/*.sh
shellcheck -x test/others/config-file/*.sh
codespell -S tags
# Do not append \n to pr_perror or fail
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*\\n"'
# Do not use %m with pr_perror or fail
! git --no-pager grep -E '^\s*\<(pr_(err|perror|warn|debug|info|msg)|fail)\>.*%m'
# Do not use errno with pr_perror or fail
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>\(".*".*errno'
# Do not append \n to pr_perror, pr_pwarn or fail
! git --no-pager grep -E '^\s*\<(pr_perror|pr_pwarn|fail)\>.*\\n"'
# Do not use %m with pr_* or fail
! git --no-pager grep -E '^\s*\<(pr_(err|perror|warn|pwarn|debug|info|msg)|fail)\>.*%m'
# Do not use errno with pr_perror, pr_pwarn or fail
! git --no-pager grep -E '^\s*\<(pr_perror|pr_pwarn|fail)\>\(".*".*errno'
# End pr_(err|warn|msg|info|debug) with \n
! git --no-pager grep -En '^\s*\<pr_(err|warn|msg|info|debug)\>.*);$$' | grep -v '\\n'
# No EOL whitespace for C files

View file

@ -60,6 +60,8 @@ void flush_early_log_buffer(int fd);
#define pr_perror(fmt, ...) pr_err(fmt ": %s\n", ##__VA_ARGS__, strerror(errno))
#define pr_pwarn(fmt, ...) pr_warn(fmt ": %s\n", ##__VA_ARGS__, strerror(errno))
#endif /* CR_NOGLIBC */
#endif /* __CR_LOG_H__ */

View file

@ -1076,14 +1076,14 @@ void tcp_cork(int sk, bool on)
{
int val = on ? 1 : 0;
if (setsockopt(sk, SOL_TCP, TCP_CORK, &val, sizeof(val)))
pr_perror("Unable to restore TCP_CORK (%d)", val);
pr_pwarn("Unable to restore TCP_CORK (%d)", val);
}
void tcp_nodelay(int sk, bool on)
{
int val = on ? 1 : 0;
if (setsockopt(sk, SOL_TCP, TCP_NODELAY, &val, sizeof(val)))
pr_perror("Unable to restore TCP_NODELAY (%d)", val);
pr_pwarn("Unable to restore TCP_NODELAY (%d)", val);
}
static int get_sockaddr_in(struct sockaddr_storage *addr, char *host, unsigned short port)