Opened 2 years ago

Closed 2 years ago

#916 closed defect (fixed)

RasdlError class should not have errno member

Reported by: dmisev Owned by: jzhang
Priority: major Milestone: 9.1
Component: rasdl Version: development
Keywords: Cc: pbaumann
Complexity: Medium


The class RasdlError? (in rasdl_error.(hh|cc) has a member called "errno". In C++ errno is a macro reserved for error handling (see

Since includes no standard headers the code compiles just fine. But when rasdl_error.hh is included in some file that already included standard headers the preprocessor transforms RasdlError? into:

class RasdlError
    RasdlError( unsigned int e );
    virtual ~RasdlError();
    virtual const char * what();
    unsigned int (*__errno_location ());

So the class layout changes since unsigned int (*errno_location()); takes no space. Therefore all methods operating on errno are accessing memory that doesn´t belong to the object. This caused rasdl to crash when called with an unknown parameter (e.g. rasdl -g).

Changing the members name to error_code fixed the problem.

Change History (2)

comment:1 Changed 2 years ago by dmisev

  • Owner changed from dmisev to jzhang
  • Status changed from new to assigned

comment:2 Changed 2 years ago by dmisev

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.