Skip to content

Commit

Permalink
uml: fix hostfs tv_usec calculations
Browse files Browse the repository at this point in the history
To convert from tv_nsec to tv_usec, one needs to divide by 1000, not multiply.

Signed-off-by: Dominique Quatravaux <dominique@quatravaux.org>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dominique Quatravaux authored and Linus Torvalds committed Feb 5, 2008
1 parent c5d4bb1 commit d7b8851
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/hostfs/hostfs_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,17 @@ int set_attr(const char *file, struct hostfs_iattr *attrs, int fd)
return err;

times[0].tv_sec = atime_ts.tv_sec;
times[0].tv_usec = atime_ts.tv_nsec * 1000;
times[0].tv_usec = atime_ts.tv_nsec / 1000;
times[1].tv_sec = mtime_ts.tv_sec;
times[1].tv_usec = mtime_ts.tv_nsec * 1000;
times[1].tv_usec = mtime_ts.tv_nsec / 1000;

if (attrs->ia_valid & HOSTFS_ATTR_ATIME_SET) {
times[0].tv_sec = attrs->ia_atime.tv_sec;
times[0].tv_usec = attrs->ia_atime.tv_nsec * 1000;
times[0].tv_usec = attrs->ia_atime.tv_nsec / 1000;
}
if (attrs->ia_valid & HOSTFS_ATTR_MTIME_SET) {
times[1].tv_sec = attrs->ia_mtime.tv_sec;
times[1].tv_usec = attrs->ia_mtime.tv_nsec * 1000;
times[1].tv_usec = attrs->ia_mtime.tv_nsec / 1000;
}

if (fd >= 0) {
Expand Down

0 comments on commit d7b8851

Please sign in to comment.