Closed zefir-o closed 2 years ago
I thought that the original code (strstr call) would catch that, but all the better: now the function is c++ish :)
Before I merge the pull request, but could you please:
Hi,
Thanks for reviewing it:
Hi,
Thanks for reviewing it:
1. According to specification https://www.cplusplus.com/reference/fstream/ifstream/ifstream/, if file doesn't exist and cannot be opened, there is no exception expected, but error would be set to the file stream object. So in this paricular case no exception handling is needed. See experiment as proof https://godbolt.org/z/6qs4rob5W
Yes, the constructor never seems to throw,
But:
rdbuf() https://www.cplusplus.com/reference/ios/ios/rdbuf/ Basic guarantee: if an exception is thrown, the stream is in a valid state. It throws an exception of member type failure if sb is a null pointer and member exceptions was set to throw for badbit.
std::stringstream::str() throws nothing, std::string::find() should never throw, there's a new excepttion. https://en.cppreference.com/w/cpp/string/basic_string/find I guess we can ignore that.
Do not make a fuzz. Simply catch all possible exceptions and return false. You may log a warning.
2. See full change: https://github.com/nschlia/ffmpegfs/pull/113/files. actually I also picked up your pattern during merge conflict resolving, which is now "/docker".
Fine. This is OK now.
Super. Patch accepted. Thanks for the update.
Sometimes, it appears that cat /proc/self/cgroup returns many lines and the first one doesn't contain anything about docker, thus running in docker mechanism returns
false
whereas it should betrue
. For example: 10:rdma:/ 9:blkio:/docker/a ... Fix docker detection mechnism by searching for pattern in the whole file.