mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 22:37:37 +03:00
Check if the fd is valid before calling close
Summary: This code calls close on fd while exiting. If the file doesn't exist the open will return -1 and close (-1) will be called. Reviewed By: strager Differential Revision: D15951485 fbshipit-source-id: ea3a52517847d75e9a822e51f360be7cb2c411da
This commit is contained in:
parent
3f2dcb8ab3
commit
92f45a1b0c
@ -375,7 +375,9 @@ void EdenConfig::loadConfig(
|
||||
parseAndApplyConfigFile(configFd, path, configSource);
|
||||
}
|
||||
SCOPE_EXIT {
|
||||
close(configFd);
|
||||
if (configFd >= 0) {
|
||||
close(configFd);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user