[Libsysio-commit] HEAD: libsysio/src getdirentries.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2009-12-17 17:41:28
|
Update of /cvsroot/libsysio/libsysio/src In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20980/src Modified Files: getdirentries.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: getdirentries.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/getdirentries.c,v retrieving revision 2.1 retrieving revision 2.2 diff -u -w -b -B -p -r2.1 -r2.2 --- getdirentries.c 25 Sep 2009 22:23:29 -0000 2.1 +++ getdirentries.c 17 Dec 2009 17:41:17 -0000 2.2 @@ -255,10 +255,26 @@ static ssize_t PREPEND(_, SYSIO_INTERFACE_NAME(getdirentries64))(int fd, char *buf, size_t nbytes, - off_t * __restrict basep) + off64_t * __restrict basep) { + _SYSIO_OFF_T ibase; + ssize_t cc; + + ibase = *basep; + if (ibase != *basep) { + errno = EINVAL; + return -1; + } - return getdirentries_common(fd, buf, nbytes, basep, (filldir_t )filldir64); + cc = + getdirentries_common(fd, + buf, + nbytes, + &ibase, + (filldir_t )filldir64); + if (cc >= 0) + *basep = ibase; + return cc; } #undef getdirentries64 |