X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funlockpt.c;h=d5ca61dd5f13d6f01da135926a17ff46862576aa;hb=0874a5828bbb4784e9c9d54243b3c978e8e54ece;hp=f2becab23753394f520b7e2e9a3d442c2c4cb6a5;hpb=e6c527d59af1fd07e33830f72c8c93e31cfd3738;p=gnulib.git diff --git a/lib/unlockpt.c b/lib/unlockpt.c index f2becab23..d5ca61dd5 100644 --- a/lib/unlockpt.c +++ b/lib/unlockpt.c @@ -1,5 +1,5 @@ /* Unlock the slave side of a pseudo-terminal from its master side. - Copyright (C) 1998, 2010 Free Software Foundation, Inc. + Copyright (C) 1998, 2010-2012 Free Software Foundation, Inc. Contributed by Zack Weinberg , 1998. This program is free software: you can redistribute it and/or modify @@ -19,6 +19,7 @@ #include +#include #include int @@ -36,6 +37,8 @@ unlockpt (int fd) #else /* Assume that the slave side of a pseudo-terminal is already unlocked by default. */ + if (fcntl (fd, F_GETFD) < 0) + return -1; return 0; #endif }