Fix remaining read(fd, NULL, 1) cases.

This commit is contained in:
riastradh 2015-04-04 12:34:44 +00:00
parent 83013a36f8
commit a26f29c67f
4 changed files with 27 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vnops.c,v 1.92 2015/03/28 19:24:05 maxv Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.93 2015/04/04 12:34:44 riastradh Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.92 2015/03/28 19:24:05 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.93 2015/04/04 12:34:44 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -532,8 +532,13 @@ msdosfs_read(void *v)
} while (error == 0 && uio->uio_resid > 0 && n != 0);
out:
if ((ap->a_ioflag & IO_SYNC) == IO_SYNC)
error = deupdat(dep, 1);
if ((ap->a_ioflag & IO_SYNC) == IO_SYNC) {
int uerror;
uerror = deupdat(dep, 1);
if (error == 0)
error = uerror;
}
bad:
fstrans_done(vp->v_mount);
return (error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs_vnops.c,v 1.56 2014/12/26 15:23:21 hannken Exp $ */
/* $NetBSD: sysvbfs_vnops.c,v 1.57 2015/04/04 12:34:45 riastradh Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.56 2014/12/26 15:23:21 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.57 2015/04/04 12:34:45 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -426,7 +426,7 @@ sysvbfs_read(void *arg)
struct sysvbfs_node *bnode = v->v_data;
struct bfs_inode *inode = bnode->inode;
vsize_t sz, filesz = bfs_file_size(inode);
int err;
int err, uerr;
const int advice = IO_ADV_DECODE(a->a_ioflag);
DPRINTF("%s: type=%d\n", __func__, v->v_type);
@ -450,7 +450,11 @@ sysvbfs_read(void *arg)
DPRINTF("%s: read %ldbyte\n", __func__, sz);
}
return sysvbfs_update(v, NULL, NULL, UPDATE_WAIT);
uerr = sysvbfs_update(v, NULL, NULL, UPDATE_WAIT);
if (err == 0)
err = uerr;
return err;
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf_vnops.c,v 1.97 2015/01/28 14:00:58 martin Exp $ */
/* $NetBSD: udf_vnops.c,v 1.98 2015/04/04 12:34:45 riastradh Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.97 2015/01/28 14:00:58 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.98 2015/04/04 12:34:45 riastradh Exp $");
#endif /* not lint */
@ -251,8 +251,13 @@ udf_read(void *v)
/* note access time unless not requested */
if (!(vp->v_mount->mnt_flag & MNT_NOATIME)) {
udf_node->i_flags |= IN_ACCESS;
if ((ioflag & IO_SYNC) == IO_SYNC)
error = udf_update(vp, NULL, NULL, NULL, UPDATE_WAIT);
if ((ioflag & IO_SYNC) == IO_SYNC) {
int uerror;
uerror = udf_update(vp, NULL, NULL, NULL, UPDATE_WAIT);
if (error == 0)
error = uerror;
}
}
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_io.c,v 1.15 2015/03/28 17:45:47 riastradh Exp $ */
/* $NetBSD: t_io.c,v 1.16 2015/04/04 12:34:44 riastradh Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -233,9 +233,6 @@ read_fault(const atf_tc_t *tc, const char *mp)
ATF_REQUIRE_EQ(rump_sys_write(fd, &ch, 1), 1);
RL(rump_sys_close(fd));
RL(fd = rump_sys_open("file", O_RDONLY | O_SYNC | O_RSYNC));
if (FSTYPE_MSDOS(tc) ||
FSTYPE_SYSVBFS(tc))
atf_tc_expect_fail("bad sync atime update code path");
ATF_REQUIRE_ERRNO(EFAULT, rump_sys_read(fd, NULL, 1) == -1);
RL(rump_sys_close(fd));
FSTEST_EXIT();