If you want to check it check it properly. For example use stat to
see if LD_PRELOAD contains an existing file or use file to see if
it's really a library. But checking if LD_PRELOAD only contains an
empty string seems like a non check. Would you also check if it
contained a space or two spaces?
Actually there is no need to check since if the file is not a valid
library the result would be an error which the user has to debug.
Something about giving users enough rope...
I was just writting to ask what happens if there's a space or a tab :-)
I think Han phrased it quite well and I agree with him. There's no need
for this check.
And the fact that you encountered an empty LD_PRELOAD was so obviously a
case of bad scripting that when you wrote the second mail and confirmed
it I decided to reply and say no to this.