Re: [Libsysio-commit] cplant: libsysio/src truncate.c
Brought to you by:
lward
From: Lee W. <le...@sa...> - 2003-10-15 20:08:33
|
Hi Ruth, I suspect you just fixed a bug caused by something entirely different. The man page for {f}truncate indicates it *only* works on regular files. Certainly not character specials... This is also verified from the Linux kernel source. The following code fragment is from do_sys_truncate: /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ error = -EISDIR; if (S_ISDIR(inode->i_mode)) goto dput_and_out; error = -EINVAL; if (!S_ISREG(inode->i_mode)) goto dput_and_out; See what I mean? Could you back your change out and try to track down why the FORTRAN compiler would even think it's attached to a regular file in the first place? Could this be related to an isatty() failure again? On Wed, 2003-10-15 at 15:36, Ruth Klundt wrote: > Update of /cvsroot/libsysio/libsysio/src > In directory sc8-pr-cvs1:/tmp/cvs-serv27657 > > Modified Files: > Tag: cplant > truncate.c > Log Message: > fix for fortran print - it calls truncate...on stdout > > Index: truncate.c > =================================================================== > RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v > retrieving revision 1.3.10.1 > retrieving revision 1.3.10.2 > diff -u -w -b -B -p -r1.3.10.1 -r1.3.10.2 > --- truncate.c 14 Oct 2003 23:39:36 -0000 1.3.10.1 > +++ truncate.c 15 Oct 2003 19:36:32 -0000 1.3.10.2 > @@ -68,7 +68,7 @@ do_truncate(struct pnode *pno, struct in > ino = pno->p_base->pb_ino; > if (!ino) > return -EBADF; > - if (!S_ISREG(ino->i_mode)) > + if (!S_ISREG(ino->i_mode) && !S_ISCHR(ino->i_mode)) > return -EISDIR; /* for others too? */ > > (void )memset(&stbuf, 0, sizeof(stbuf)); > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > SourceForge.net hosts over 70,000 Open Source Projects. > See the people who have HELPED US provide better services: > Click here: http://sourceforge.net/supporters.php > _______________________________________________ > Libsysio-commit mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libsysio-commit -- Lee Ward <le...@sa...> Sandia National Laboratories |