Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: How can a file be truncated on System V?? Keywords: link, unlink, directory Message-ID: <1539@auspex.auspex.com> Date: 3 May 89 06:47:52 GMT References: <651@mitisft.Convergent.COM> <13725@steinmetz.ge.com> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 15 > There was a method in wizards a few years ago I believe. It had to do >with using O_TRUNC, which seems to truncate to the position of the >current file pointer. Not on S5R3.1, and not on 4.3BSD. O_TRUNC is used *only* on "open", and since the whole point of "open" is to *create* a file pointer, there *is* no current file pointer.... O_TRUNC isn't used on "fcntl". >There was a trick with reopen or dup or ??? which >allowed opening of an already open file. Well, "dup" will give you a second file descriptor that refers to an already-open file, but there's no trick that lets you open an already-open file with "open", unless you have something like the "/dev/fd" mechanism.