From owner-freebsd-chat Sat Mar 28 05:44:00 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA17391 for freebsd-chat-outgoing; Sat, 28 Mar 1998 05:44:00 -0800 (PST) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from mail.cs.tu-berlin.de (root@mail.cs.tu-berlin.de [130.149.17.13]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA17386 for ; Sat, 28 Mar 1998 05:43:57 -0800 (PST) (envelope-from wosch@cs.tu-berlin.de) Received: from panke.panke.de (anonymous216.ppp.cs.tu-berlin.de [130.149.17.216]) by mail.cs.tu-berlin.de (8.8.8/8.8.8) with ESMTP id OAA17602; Sat, 28 Mar 1998 14:38:49 +0100 (MET) Received: (from wosch@localhost) by panke.panke.de (8.8.5/8.6.12) id OAA05160; Sat, 28 Mar 1998 14:39:09 +0100 (MET) To: dg@root.com Cc: "Viren R. Shah" , freebsd-chat@FreeBSD.ORG Subject: Re: wcarchive user limit References: <199803272042.MAA07670@implode.root.com> From: Wolfram Schneider Date: 28 Mar 1998 15:38:59 +0200 In-Reply-To: David Greenman's message of Fri, 27 Mar 1998 12:42:50 -0800 Message-ID: Lines: 20 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org David Greenman writes: > >Logged in to ftp.freebsd.org. > >Welcome to wcarchive - home ftp site for Walnut Creek CDROM. > >There are currently 3001 users out of 3000 possible. > >--- > > > >Hmm..off-by-one error? or a race condition? > > Race condition - a context switch occured at just the wrong time and this > allowed an extra user in when it shouldn't have. I could add locking around > the check/increment of the user count, but why bother? You could also lie and claim he is user 3000 (instead 3001). maxuser = 3000; printf("There are currently %d users out of %d possible.", (user < maxuser ? user : maxuser), maxuser); -- Wolfram Schneider http://www.freebsd.org/~wosch/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message