From: chas williams - CONTRACTOR Date: Fri, 20 Apr 2012 14:58:28 +0000 (-0400) Subject: login: use getdtablesize() correctly in login.c X-Git-Tag: v2.22-rc1~495 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10610816191a7c8c75f184b5ba26861bd5b89d5d;p=thirdparty%2Futil-linux.git login: use getdtablesize() correctly in login.c getdtablesize() is the number of descriptors and since decriptors start at 0, its value isnt the largest descriptors possible. One should use getdtablesize() - 1 instead. Signed-off-by: Chas Williams - CONTRACTOR --- diff --git a/login-utils/login.c b/login-utils/login.c index bb977e5d9e..e2c0f8015c 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1290,7 +1290,7 @@ int main(int argc, char **argv) *p++ = ' '; } - for (cnt = getdtablesize(); cnt > 2; cnt--) + for (cnt = (getdtablesize() - 1); cnt > 2; cnt--) close(cnt); setpgrp(); /* set pgid to pid this means that setsid() will fail */