From: Nickolai Zeldovich Date: Thu, 20 May 2004 20:15:04 +0000 (+0000) Subject: uafs-fixes-20040520 X-Git-Tag: openafs-devel-1_3_65~93 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e21149cec321d055c715d0362e77a85118cdf561;p=packages%2Fo%2Fopenafs.git uafs-fixes-20040520 Make uafs not crash if uafs_fstat() is used. Fix open(O_RDONLY). --- diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 2aa393edd..2d940ec12 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -2751,6 +2751,10 @@ uafs_open_r(char *path, int flags, int mode) if (flags & (O_WRONLY | O_RDWR)) { openFlags |= FWRITE; } + if ((openFlags & (FREAD | FWRITE)) == 0) { + /* O_RDONLY is 0, so ... */ + openFlags |= FREAD; + } /* * Truncate if necessary @@ -3064,7 +3068,6 @@ uafs_fstat_r(int fd, struct stat *buf) return -1; } code = uafs_GetAttr(vp, buf); - VN_RELE(vp); if (code) { errno = code; return -1;