Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!apple!oliveb!bbn!bbn.com!fkittred From: fkittred@bbn.com (Fletcher Kittredge) Newsgroups: comp.sys.hp Subject: Re: Strange behaviour on HP9000/825 Keywords: errno 25 cc errors Message-ID: <43305@bbn.COM> Date: 26 Jul 89 12:17:57 GMT References: <227@innovus.UUCP> Sender: news@bbn.COM Reply-To: fkittred@BBN.COM (Fletcher Kittredge) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 34 In article <227@innovus.UUCP> martin@innovus.UUCP (Martin Renters) writes: > >We just found some rather strange behaviour on our 9000/825 running >HP-UX 3.0. Seems we get an errno 25 (not a typewriter) on the first >I/O we do on any newly opened file, although the I/O is actually carried >out. Any subsequent I/Os work fine, without error. Both HFS and NFS >filesystems seem to have this problem. >File opens, errno=0, fp=1073742056 >File read, errno=25, fp=1073742056, buffer=#include >File read2, errno=0, fp=1073742056, buffer=#include > >Anybody care to comment about why this is happening? > Sure, I'll comment. I think you have a fundamental misunderstanding of errno. It is only guaranteed to be set to a meaningfull value after a system call fails. Since you don't check to see if a system call fails, basically what your code is doing is checking the value of an uninitialized variable. As one might expect, you get garbage. I recommend the following books: "The Unix Programming Environment" Kernighan and Pike Prentice-Hall, 1984 "Advanced Unix Programming" Rochkind Prentice-Hall, 1985 regards, fletcher Fletcher E. Kittredge fkittred@bbn.com