trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [1/2] trafficserver git commit: TS-3444 Eliminate unecessary stat() call, CID 1200031
Date Wed, 20 May 2015 19:51:37 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 88056df2a -> 1dfd8c240


TS-3444 Eliminate unecessary stat() call, CID 1200031


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ac785337
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ac785337
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ac785337

Branch: refs/heads/master
Commit: ac785337bed674fa85932fd769db8e7c2ced63d5
Parents: 88056df
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Mon May 18 08:49:01 2015 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Wed May 20 13:44:46 2015 -0600

----------------------------------------------------------------------
 plugins/experimental/healthchecks/healthchecks.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ac785337/plugins/experimental/healthchecks/healthchecks.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/healthchecks/healthchecks.c b/plugins/experimental/healthchecks/healthchecks.c
index b811ba5..60398ca 100644
--- a/plugins/experimental/healthchecks/healthchecks.c
+++ b/plugins/experimental/healthchecks/healthchecks.c
@@ -108,19 +108,15 @@ typedef struct HCState_t {
 static void
 reload_status_file(HCFileInfo *info, HCFileData *data)
 {
-  struct stat buf;
+  FILE *fd;
 
   memset(data, 0, sizeof(HCFileData));
-  if (!stat(info->fname, &buf)) {
-    FILE *fd;
-
-    if (NULL != (fd = fopen(info->fname, "r"))) {
-      data->exists = 1;
-      do {
-        data->b_len = fread(data->body, 1, MAX_BODY_LEN, fd);
-      } while (!feof(fd)); /*  Only save the last 16KB of the file ... */
-      fclose(fd);
-    }
+  if (NULL != (fd = fopen(info->fname, "r"))) {
+    data->exists = 1;
+    do {
+      data->b_len = fread(data->body, 1, MAX_BODY_LEN, fd);
+    } while (!feof(fd)); /*  Only save the last 16KB of the file ... */
+    fclose(fd);
   }
 }
 


Mime
View raw message