Jump to content

Same values for the following errors: ENOTRECOVERABLE/EHOSTDOWN (64) and EOWNERDEAD/EUSERS (68)


Go to solution Solved by Altyn,

Recommended Posts

Hello KOS Team!

I'm using KasperskyOS-Community-Edition-1.1.1.13 and I've noticed that some errors can't be used together within the same switch because they have the same value, specifically: ENOTRECOVERABLE/EHOSTDOWN (64) and EOWNERDEAD/EUSERS (68). Is it planned to fix this or it is intended? Thanks.

For me it is clear why EAGAIN and EWOULDBLOCK have the same value:

    https://man7.org/linux/man-pages/man3/errno.3.html
    All the error names specified by POSIX.1 must have distinct
       values, with the exception of EAGAIN and EWOULDBLOCK, which may
       be the same.  On Linux, these two have the same value on all
       architectures.

The code:

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
 
int main(int argc, const char *argv[])
{
    int err = ENOTRECOVERABLE;
    switch (err)
    {
        case ENOTRECOVERABLE:
            fprintf(stderr,"ENOTRECOVERABLE\n");
            break;
        case EHOSTDOWN:
            fprintf(stderr,"EHOSTDOWN\n");
            break;
        case EOWNERDEAD:
            fprintf(stderr,"EOWNERDEAD\n");
            break;
        case EUSERS:
            fprintf(stderr,"EUSERS\n");
            break;
    }    
 
    return EXIT_SUCCESS;
}
 
The error:
 
[ 38%] Building C object hello/CMakeFiles/Hello.dir/src/hello.c.o
/opt/KasperskyOS-Community-Edition-1.1.1.13/examples/hello/hello/src/hello.c: In function 'main':
/opt/KasperskyOS-Community-Edition-1.1.1.13/examples/hello/hello/src/hello.c:14:9: error: duplicate case value
   14 |         case EHOSTDOWN:
      |         ^~~~
/opt/KasperskyOS-Community-Edition-1.1.1.13/examples/hello/hello/src/hello.c:11:9: note: previously used here
   11 |         case ENOTRECOVERABLE:
      |         ^~~~
/opt/KasperskyOS-Community-Edition-1.1.1.13/examples/hello/hello/src/hello.c:20:9: error: duplicate case value
   20 |         case EUSERS:
      |         ^~~~
/opt/KasperskyOS-Community-Edition-1.1.1.13/examples/hello/hello/src/hello.c:17:9: note: previously used here
   17 |         case EOWNERDEAD:
      |         ^~~~
Link to comment
Share on other sites

  • Solution

Hello!

 

We have created a request to fix this bug, we will change the error constants so that they do not intersect.
For now, we recommend considering the values 64 as ENOTRECOVERABLE, and for 68 as EOWNERDEAD, as they are defined in POSIX.

 

Thank you for your patience.

  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...