Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.xenix Subject: Re: 'Rename' Library Function? Keywords: rename lib Message-ID: <3302@solo9.cs.vu.nl> Date: 19 Sep 89 23:41:43 GMT References: <[157]unix@oldcolo.UUCP> <1167@ispi.UUCP> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 24 jbayer@ispi.UUCP (Jonathan Bayer) writes: \... if ( (z = link (oldname, newname)) == 0) { \ z = unlink (oldname); } \ \ if (z) printf ("Sorry -- error in renaming file %s to %s!\n", oldname, \ finalname); \ printf ("error: %d\n",errno); ...leading to `interesting' error messages like: error: 25 /* Not a typewriter */ Use something like the following instead: if (z) { int saved_errno = errno; printf(...); printf("error: %d\n", saved_errno); } -- creat(2) shouldn't have been create(2): |Maarten Litmaath @ VU Amsterdam: it shouldn't have existed at all. |maart@cs.vu.nl, mcvax!botter!maart