From eef100d3e42e30b98b2218a102d98841e2e5e41f Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Sun, 31 Jan 1999 23:49:56 +0000 Subject: Sun Jan 31 18:27:42 1999 Thomas Bushnell, BSG * file-utimes.c (netfs_S_file_utimes): Understand new semantics for setting to current time. * netfs.h (netfs_attempt_utimes): Update documentation. --- libnetfs/file-utimes.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'libnetfs/file-utimes.c') diff --git a/libnetfs/file-utimes.c b/libnetfs/file-utimes.c index abe2f6c4..45adf825 100644 --- a/libnetfs/file-utimes.c +++ b/libnetfs/file-utimes.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -28,17 +28,26 @@ netfs_S_file_utimes (struct protid *user, { struct timespec atime, mtime; error_t err; + + if (atimein.microseconds != -1) + { + atime.tv_sec = atimein.seconds; + atime.tv_nsec = atimein.microseconds * 1000; + } - atime.tv_sec = atimein.seconds; - atime.tv_nsec = atimein.microseconds * 1000; - mtime.tv_sec = mtimein.seconds; - mtime.tv_nsec = mtimein.microseconds * 1000; + if (mtimein.microseconds != -1) + { + mtime.tv_sec = mtimein.seconds; + mtime.tv_nsec = mtimein.microseconds * 1000; + } if (!user) return EOPNOTSUPP; mutex_lock (&user->po->np->lock); - err = netfs_attempt_utimes (user->user, user->po->np, &atime, &mtime); + err = netfs_attempt_utimes (user->user, user->po->np, + atimein.microseconds != -1 ? &atime : 0, + mtimein.microseconds != -1 ? &mtime : 0); mutex_unlock (&user->po->np->lock); return err; } -- cgit v1.2.3