@@ -1,6 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
static inline void _reset_errno_(int *saved_errno) {
|
||||
@@ -28,6 +31,11 @@ static inline int negative_errno(void) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
static inline char *strerror_safe(int error) {
|
||||
/* 'safe' here does NOT mean thread safety. */
|
||||
return strerror(abs(error));
|
||||
}
|
||||
|
||||
/* Hint #1: ENETUNREACH happens if we try to connect to "non-existing" special IP addresses, such as ::5.
|
||||
*
|
||||
* Hint #2: The kernel sends e.g., EHOSTUNREACH or ENONET to userspace in some ICMP error cases. See the
|
||||
|
||||
Reference in New Issue
Block a user