Skip to content

Check return value of getcwd() #51

@bnoordhuis

Description

@bnoordhuis

I noticed the following compiler warning:

../omr-agentcore/src/ibmras/monitoring/connector/headless/HLConnector.cpp: In member function 'void ibmras::monitoring::connector::headless::HLConnector::startNewTempDir()':
../omr-agentcore/src/ibmras/monitoring/connector/headless/HLConnector.cpp:206:40: warning: ignoring return value of 'char* getcwd(char*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
  getcwd(cDirectory, sizeof(cDirectory));

cDirectory is used afterwards but will contain stack garbage if getcwd() failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions