From e21149cec321d055c715d0362e77a85118cdf561 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Thu, 20 May 2004 20:15:04 +0000 Subject: [PATCH] uafs-fixes-20040520 Make uafs not crash if uafs_fstat() is used. Fix open(O_RDONLY). --- src/afs/UKERNEL/afs_usrops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 2aa393e..2d940ec 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; -- 1.9.4