In sync(), don't dereference the proc pointer if it's NULL. Should fix

most or all of the problems with calling sync() without a curproc (which
can happen in machdep.c during a panic sync).
This commit is contained in:
David Greenman 1995-02-13 13:45:04 +00:00
parent 1e3a24e880
commit 2655f62632
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6343
2 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.15 1994/10/21 01:19:15 wollman Exp $
* $Id: vfs_syscalls.c,v 1.16 1994/11/04 14:41:34 davidg Exp $
*/
#include <sys/param.h>
@ -331,7 +331,7 @@ sync(p, uap, retval)
!vfs_busy(mp)) {
asyncflag = mp->mnt_flag & MNT_ASYNC;
mp->mnt_flag &= ~MNT_ASYNC;
VFS_SYNC(mp, MNT_NOWAIT, p->p_ucred, p);
VFS_SYNC(mp, MNT_NOWAIT, p != NULL ? p->p_ucred : NOCRED, p);
if (asyncflag)
mp->mnt_flag |= MNT_ASYNC;
vfs_unbusy(mp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.15 1994/10/21 01:19:15 wollman Exp $
* $Id: vfs_syscalls.c,v 1.16 1994/11/04 14:41:34 davidg Exp $
*/
#include <sys/param.h>
@ -331,7 +331,7 @@ sync(p, uap, retval)
!vfs_busy(mp)) {
asyncflag = mp->mnt_flag & MNT_ASYNC;
mp->mnt_flag &= ~MNT_ASYNC;
VFS_SYNC(mp, MNT_NOWAIT, p->p_ucred, p);
VFS_SYNC(mp, MNT_NOWAIT, p != NULL ? p->p_ucred : NOCRED, p);
if (asyncflag)
mp->mnt_flag |= MNT_ASYNC;
vfs_unbusy(mp);