3 ms·
> So I understand it has been considered best practice to check the file before opening it? Check it... for what?
by chrisseaton 6y ago
> So I understand it has been considered best practice to check the file before opening it?
Check it... for what?
- coldtea 6y agoFor presence...
- chrisseaton 6y agoWhy do you need to separately check for presence before you use dlopen? If it's not there dlopen will give you a nice error message - no need to check yourself. Are you currently checking files are there before you dlopen them? How do you avoid a race between the stat and the dlopen? What happens if the file is removed between them? Seems broken and you shouldn't be doing this in the first place.
- zaarn 6y agoIt is usually unlikely that a file will be removed between stat and dlopen, such errors occur rarely. Even more rarely when the file happens to be a systems lib or plugin lib. Some errors occur rarely enough that it isn't worth worrying about.