Added feature to check whatever the "fd" is -1.

Added feature to check whatever the "fd" is -1.