Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.unix.wizards Subject: Re: of course! Message-ID: <485@mwtech.UUCP> Date: 23 Nov 89 12:39:39 GMT References: <152@norsat.UUCP> <2586@unisoft.UUCP> <15769@bloom-beacon.MIT.EDU> <17264@rpp386.cactus.org> <4526@ski.cs.vu.nl> <17303@rpp386. Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 19 In article <1051@root44.co.uk> gwc@root.co.uk (Geoff Clare) writes: [first part deleted] >The fact that the strcat() may write past the end of dir[] is more of >a problem. Another is that PATH_MAX might not be defined (it should >always be obtained via pathconf() in portable applications). Anyway, >using a maximum length array is rather wasteful - malloc(strlen(path)+3) >would be much better all round. But then you should not forget to check the result (in a portable approach you cannot assume these huge amount of memory, some people are used to have - or ULIMIT may be set low in the environment, the program runs). And of course: Don't forget to do a 'free'. And what should the programm do, if there is no memory from malloc() - abort? The one who uses the directory-check function might not like this ... Ehhm, what was the original question? Something faster than 'access()'. Seems to be the time to stop this now .... MW