summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorReimer Behrends <behrends@gmail.com>2015-05-13 12:26:34 +0200
committerReimer Behrends <behrends@gmail.com>2015-05-13 12:26:34 +0200
commit28dd0407bbee1bbbfeec92e60f3836d3845a09d6 (patch)
tree60f21d4f55f5a396dcfdfc43421d19403faafa37
parent0b184f2584221543a7dec9c8ae4a700533919e0c (diff)
downloadNim-28dd0407bbee1bbbfeec92e60f3836d3845a09d6.tar.gz
Fix behavior of os.getFileInfo() for symbolic links.
The calls to lstat() and stat() were switched. As a result,
links weren't followed for followLink == true and links were
followed for followLink == false.
-rw-r--r--lib/pure/os.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index f53abe81d..3a5bcbfa1 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -2033,10 +2033,10 @@ proc getFileInfo*(path: string, followSymlink = true): FileInfo =
   else:
     var rawInfo: TStat
     if followSymlink:
-      if lstat(path, rawInfo) < 0'i32:
+      if stat(path, rawInfo) < 0'i32:
         raiseOSError(osLastError())
     else:
-      if stat(path, rawInfo) < 0'i32:
+      if lstat(path, rawInfo) < 0'i32:
         raiseOSError(osLastError())
     rawToFormalFileInfo(rawInfo, result)