Updated to use errno instead of error_code in lg2

Since the std::error_code parameter is used in the std::filesystem
library to capture exception errors, but for some methods (such as
exists), if the file does not exist, the error_code is still 0,
because it is explained in cppreference:

```
Sets a std::error_code& parameter to the OS API error code if an OS
API call fails, and executes ec.clear() if no errors occur.
```

So the log printed as "Failed to find xxx file: success", This isn't
very clear about this log description, why the file is not found, and
then success is printed. So before printing the ec, we should first
check if it is non-zero.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I2829a5d3c22b14b8e03077f62869fb2195b19680
1 file changed