Change EPERM to OGS_EPERM (#1436,#1404)

This commit is contained in:
Sukchan Lee 2022-03-16 20:32:19 +09:00
parent f060da45d5
commit a6ec206998
2 changed files with 4 additions and 2 deletions

View File

@ -32,6 +32,7 @@ extern "C" {
typedef DWORD ogs_err_t;
#define OGS_EPERM ERROR_ACCESS_DENIED
#define OGS_ENOMEM ERROR_NOT_ENOUGH_MEMORY
#define OGS_EACCES ERROR_ACCESS_DENIED
#define OGS_EEXIST ERROR_ALREADY_EXISTS
@ -51,6 +52,7 @@ typedef DWORD ogs_err_t;
typedef int ogs_err_t;
#define OGS_EPERM EPERM
#define OGS_ENOMEM ENOMEM
#define OGS_EACCES EACCES
#define OGS_EEXIST EEXIST

View File

@ -184,10 +184,10 @@ int ogs_bind_to_device(ogs_socket_t fd, const char *device)
ogs_debug("SO_BINDTODEVICE:[%s]", device);
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1);
if (rc != OGS_OK) {
int err = errno;
int err = ogs_errno;
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
"setsockopt(SOL_SOCKET, SO_BINDTODEVICE, %s) failed", device);
if (err == EPERM)
if (err == OGS_EPERM)
ogs_error("You need to grant CAP_NET_RAW privileges to use SO_BINDTODEVICE.");
return OGS_ERROR;
}