Initialize birthtime fields in vn_stat() to prevent stat(2) from

returning uninitialized birthtime. Most file systems don't initialize
birthtime properly in their VOP_GETTATTR().

Submitted by:   Jaakko Heinonen <jh saunalahti fi>
Reviewed by:	bde
Discussed on:   freebsd-fs
MFC after:	1 month
This commit is contained in:
Konstantin Belousov 2008-09-20 19:43:22 +00:00
parent cb959fa205
commit ea60a5f526
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183211

View File

@ -703,6 +703,15 @@ vn_stat(vp, sb, active_cred, file_cred, td)
#endif
vap = &vattr;
/*
* Initialize defaults for new and unusual fields, so that file
* systems which don't support these fields don't need to know
* about them.
*/
vap->va_birthtime.tv_sec = -1;
vap->va_birthtime.tv_nsec = 0;
error = VOP_GETATTR(vp, vap, active_cred);
if (error)
return (error);