bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libnetfs file-utimes.c unnecessary computations


From: Flávio Cruz
Subject: [PATCH] libnetfs file-utimes.c unnecessary computations
Date: Tue, 1 Jul 2008 22:34:03 +0000

Hey folks,

In file-utimes.c the port existence is only verified after some
computations on the atime and mtime timespec's are done. That is
unnecessary when we exit with EOPNOTSUPP. This patches just changes
the order of the check.

Index: file-utimes.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libnetfs/file-utimes.c,v
retrieving revision 1.6
diff -u -r1.6 file-utimes.c
--- file-utimes.c       31 Jan 1999 23:49:54 -0000      1.6
+++ file-utimes.c       29 Jun 2008 23:21:11 -0000
@@ -29,6 +29,9 @@
   struct timespec atime, mtime;
   error_t err;

+  if (!user)
+    return EOPNOTSUPP;
+
   if (atimein.microseconds != -1)
     {
       atime.tv_sec = atimein.seconds;
@@ -41,9 +44,6 @@
       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,
                              atimein.microseconds != -1 ? &atime : 0,


Flávio.

Attachment: libnetfs-utimes-unneeded.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]