about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-11-20 20:23:45 +0000
committerUlrich Drepper <drepper@redhat.com>2004-11-20 20:23:45 +0000
commit250ecb48d516b08be7d0fdba0a7ba5146e148a77 (patch)
treea9c28d14a760652bc6a5cc2081c7210856921ab2 /time
parentd3a9cb0c26d61f84586d37a29c4881614b612a69 (diff)
downloadglibc-250ecb48d516b08be7d0fdba0a7ba5146e148a77.tar.gz
glibc-250ecb48d516b08be7d0fdba0a7ba5146e148a77.tar.xz
glibc-250ecb48d516b08be7d0fdba0a7ba5146e148a77.zip
	* time/tzfile.c (__tzfile_read): Avoid open for checking whether
	the file we already use changed.
Diffstat (limited to 'time')
-rw-r--r--time/tzfile.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/time/tzfile.c b/time/tzfile.c
index 48c1e4d790..e95fd55f36 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -149,27 +149,30 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
       file = new;
     }
 
+  /* If we were already using tzfile, check whether the file changed.  */
+  struct stat64 st;
+  if (was_using_tzfile
+      && stat64 (file, &st) == 0
+      && tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
+      && tzfile_mtime == st.st_mtime)
+    {
+      /* Nothing to do.  */
+      __use_tzfile = 1;
+      return;
+    }
+
   /* Note the file is opened with cancellation in the I/O functions
      disabled.  */
   f = fopen (file, "rc");
   if (f == NULL)
     goto ret_free_transitions;
 
-  /* Get information about the file.  */
-  struct stat64 st;
+  /* Get information about the file we are actually using.  */
   if (fstat64 (fileno (f), &st) != 0)
     {
       fclose (f);
       goto ret_free_transitions;
     }
-  if (was_using_tzfile && tzfile_ino == st.st_ino && tzfile_dev == st.st_dev
-      && tzfile_mtime == st.st_mtime)
-    {
-      /* It's the same file.  No further work needed.  */
-      fclose (f);
-      __use_tzfile = 1;
-      return;
-    }
 
   free ((void *) transitions);
   transitions = NULL;