You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2014/04/29 19:08:25 UTC
[2/5] git commit: convert log-root to canonical path in case it is
relative
convert log-root to canonical path in case it is relative
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/6fd68a5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/6fd68a5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/6fd68a5f
Branch: refs/heads/master
Commit: 6fd68a5fa092a24397bf4492533772d89e1df02e
Parents: 39acc27
Author: P. Taylor Goetz <pt...@gmail.com>
Authored: Sun Apr 27 17:26:51 2014 -0400
Committer: P. Taylor Goetz <pt...@gmail.com>
Committed: Sun Apr 27 17:26:51 2014 -0400
----------------------------------------------------------------------
.../src/clj/backtype/storm/daemon/logviewer.clj | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/6fd68a5f/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/logviewer.clj b/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
index cb31de4..7d8b7aa 100644
--- a/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -33,17 +33,17 @@
(defn tail-file [path tail root-dir]
(let [flen (.length (clojure.java.io/file path))
skip (- flen tail)]
- (if (.startsWith path root-dir)
+ (if (.startsWith path (.getCanonicalPath (File. root-dir)))
(with-open [input (clojure.java.io/input-stream path)
output (java.io.ByteArrayOutputStream.)]
(if (> skip 0) (.skip input skip))
- (let [buffer (make-array Byte/TYPE 1024)]
- (loop []
- (let [size (.read input buffer)]
- (when (and (pos? size) (< (.size output) tail))
- (do (.write output buffer 0 size)
- (recur))))))
- (.toString output)) "File not found")
+ (let [buffer (make-array Byte/TYPE 1024)]
+ (loop []
+ (let [size (.read input buffer)]
+ (when (and (pos? size) (< (.size output) tail))
+ (do (.write output buffer 0 size)
+ (recur))))))
+ (.toString output)) "File not found")
))
(defn log-root-dir