[Libsysio-commit] HEAD: libsysio/misc fhi.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2009-12-17 17:41:26
|
Update of /cvsroot/libsysio/libsysio/misc In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20980/misc Modified Files: fhi.c Log Message: Fixed for 32-bit build. The 64-bit getdirentries routines in both the regular source and the file handles interface assumed 64-bit _SYSIO_OFF_T. Fixed, now. They will return (-1, EINVAL) if given a base pointer outside what is supported by the internal offset. Index: fhi.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/misc/fhi.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- fhi.c 7 Dec 2009 22:00:23 -0000 1.10 +++ fhi.c 17 Dec 2009 17:41:17 -0000 1.11 @@ -1031,8 +1031,9 @@ ssize_t SYSIO_INTERFACE_NAME(fhi_getdirentries64)(struct file_handle_info *fhi, char *buf, size_t nbytes, - off_t * __restrict basep) + off64_t * __restrict basep) { + _SYSIO_OFF_T ibase; struct pnode *pno; int err; ssize_t cc; @@ -1045,6 +1046,11 @@ SYSIO_INTERFACE_NAME(fhi_getdirentries64 basep); do { + ibase = *basep; + if (ibase != *basep) { + cc =- EINVAL; + break; + } err = find_alias(fhi, &pno); if (err) { cc = -ESTALE; @@ -1054,10 +1060,13 @@ SYSIO_INTERFACE_NAME(fhi_getdirentries64 cc = _sysio_open(pno, O_RDONLY, 0); if (cc) break; - cc = _sysio_p_filldirentries(pno, buf, nbytes, basep); + cc = _sysio_p_filldirentries(pno, buf, nbytes, &ibase); if (PNOP_CLOSE(pno) != 0) abort(); P_PUT(pno); + if (cc < 0) + break; + *basep = ibase; } while (0); SYSIO_INTERFACE_RETURN(cc, |