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)
 
div>
db01afa8 ^
4a48bedc ^
db01afa8 ^



431bbb1a ^
db01afa8 ^



a0331a9b ^
431bbb1a ^
db01afa8 ^

b75d9d45 ^

08f4628e ^
b75d9d45 ^
4a48bedc ^
b75d9d45 ^




08f4628e ^

a0331a9b ^
b75d9d45 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48