The code probably used an if statement somewhere to throw an exception if some condition is incorrect, then called strerror(), which gets the status of the last syscall. But the error was probably a logical one in the application and had nothing to do with the last syscall. Or perhaps success of a syscall is itself an error condition. For example if a file already existing should be detected and cause a failure, calling stat() successfully would be an error
The code probably used an if statement somewhere to throw an exception if some condition is incorrect, then called
strerror()
, which gets the status of the last syscall. But the error was probably a logical one in the application and had nothing to do with the last syscall. Or perhaps success of a syscall is itself an error condition. For example if a file already existing should be detected and cause a failure, callingstat()
successfully would be an error