🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #53895

Re: Bizarre happenings from nnrpperlauth

#53895
From: Jan Ingvoldstad
Date: Tue, 21 Aug 2001 09:08
32 lines
2231 bytes
On Tue, 21 Aug 2001 08:26:41 GMT, gph@comp.leeds.ac.uk (G Hardman) said:

> open(FILE, "<".$groupsfile) || ($returnval = $nopost);
> if($returnval)
> {
>     # some error message
> }

You don't close the file handle here.  If your script does not
(nearly) immediately exit after this, then you'll have an open file
handle, possibly while something else happens.

If you don't need the file handle after this (which the else branch of
the if seems to imply), you should close it anyway.

One suggestion is:

open(FILE, "<".$groupsfile) || ($returnval = $nopost);
if($returnval) {
# Do that error message stuff
} else {
# Read from the file handle
# No close(FILE) here
}
close(FILE);

-- 
In the beginning was the Bit, and the Bit was Zero.  Then Someone
said, Let there be One, and there was One.  And Someone blessed them,
and Someone said unto them, Be fruitful, and multiply, and replenish
the Word and subdue it: and have dominion over every thing that is.
Technical Details
Message-ID: <oaslmkdbx1o.fsf@thrir.ifi.uio.no>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.uchicago.edu!vixen.cso.uiuc.edu!howland.erols.net!newspharm.inet.tele.dk.MISMATCH!news.tele.dk!small.news.tele.dk!129.240.148.23!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail
References: <GIDKIJ.8pp@leeds.ac.uk> <yl8zgefbe6.fsf@windlord.stanford.edu> <GIEssJ.Jtp@leeds.ac.uk>

Show Full Headers
Complete Article Headers
Message-ID: <oaslmkdbx1o.fsf@thrir.ifi.uio.no>
Subject: Re: Bizarre happenings from nnrpperlauth
Date: Tue, 21 Aug 2001 09:08:03 +0000
From: Jan Ingvoldstad <jani@ifi.uio.no>
References: <GIDKIJ.8pp@leeds.ac.uk> <yl8zgefbe6.fsf@windlord.stanford.edu> <GIEssJ.Jtp@leeds.ac.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.uchicago.edu!vixen.cso.uiuc.edu!howland.erols.net!newspharm.inet.tele.dk.MISMATCH!news.tele.dk!small.news.tele.dk!129.240.148.23!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail
Newsgroups: news.software.nntp
Organization: KRST, People's Front Against MWM
Lines: 31
NNTP-Posting-Host: thrir.ifi.uio.no
Mime-Version: 1.0 (generated by tm-edit 7.106)
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: maud.ifi.uio.no 998384862 3591 129.240.66.152 (21 Aug 2001 09:07:42 GMT)
X-Complaints-To: abuse@ifi.uio.no
NNTP-Posting-Date: 21 Aug 2001 09:07:42 GMT
X-url: http://www.stud.ifi.uio.no/~jani/
X-Newsreader: Gnus v5.7/Emacs 20.3