[Libsysio-commit] HEAD: libsysio/src truncate.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2003-10-23 20:23:31
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv13939 Modified Files: truncate.c Log Message: set EINVAL for non-dir, non-regular file Index: truncate.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/truncate.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- truncate.c 10 Oct 2003 18:50:31 -0000 1.4 +++ truncate.c 23 Oct 2003 15:20:31 -0000 1.5 @@ -68,8 +68,10 @@ do_truncate(struct pnode *pno, struct in ino = pno->p_base->pb_ino; if (!ino) return -EBADF; + if (S_ISDIR(ino->i_mode)) /* for others too? */ + return -EISDIR; if (!S_ISREG(ino->i_mode)) - return -EISDIR; /* for others too? */ + return -EINVAL; (void )memset(&stbuf, 0, sizeof(stbuf)); stbuf.st_size = length; |