omr-agentcore icon indicating copy to clipboard operation
omr-agentcore copied to clipboard

Check return value of getcwd()

Open bnoordhuis opened this issue 8 years ago • 1 comments

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.

bnoordhuis avatar Jun 26 '17 10:06 bnoordhuis

thanks for the heads up

tobespc avatar Jun 26 '17 10:06 tobespc