aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/prim_file.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-07-26 09:56:21 +0200
committerJohn Högberg <[email protected]>2018-07-26 09:56:21 +0200
commita0b2cc0a377d780fe938ba9be3e417c7a8e00914 (patch)
tree0d5714d31e6c67faeaaab6f76351bf3bec4a8591 /erts/preloaded/src/prim_file.erl
parentf678e1b71987075cfd7816da7e7dd828ea630115 (diff)
parent4664de710ded469916fcc8f85d4e9791adc319e9 (diff)
downloadotp-a0b2cc0a377d780fe938ba9be3e417c7a8e00914.tar.gz
otp-a0b2cc0a377d780fe938ba9be3e417c7a8e00914.tar.bz2
otp-a0b2cc0a377d780fe938ba9be3e417c7a8e00914.zip
Merge branch 'maint-21' into maint
Diffstat (limited to 'erts/preloaded/src/prim_file.erl')
-rw-r--r--erts/preloaded/src/prim_file.erl21
1 files changed, 13 insertions, 8 deletions
diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl
index 41ff38359c..517ca74301 100644
--- a/erts/preloaded/src/prim_file.erl
+++ b/erts/preloaded/src/prim_file.erl
@@ -580,15 +580,20 @@ read_link_info(Name, Opts) ->
read_info_1(Name, 0, proplist_get_value(time, Opts, local)).
read_info_1(Name, FollowLinks, TimeType) ->
- try read_info_nif(encode_path(Name), FollowLinks) of
- {error, Reason} -> {error, Reason};
- FileInfo ->
- CTime = from_posix_seconds(FileInfo#file_info.ctime, TimeType),
- MTime = from_posix_seconds(FileInfo#file_info.mtime, TimeType),
- ATime = from_posix_seconds(FileInfo#file_info.atime, TimeType),
- {ok, FileInfo#file_info{ ctime = CTime, mtime = MTime, atime = ATime }}
+ try
+ case read_info_nif(encode_path(Name), FollowLinks) of
+ {error, Reason} ->
+ {error, Reason};
+ FileInfo ->
+ CTime = from_posix_seconds(FileInfo#file_info.ctime, TimeType),
+ MTime = from_posix_seconds(FileInfo#file_info.mtime, TimeType),
+ ATime = from_posix_seconds(FileInfo#file_info.atime, TimeType),
+ {ok, FileInfo#file_info{ ctime = CTime,
+ mtime = MTime,
+ atime = ATime }}
+ end
catch
- error:badarg -> {error, badarg}
+ error:_ -> {error, badarg}
end.
write_file_info(Filename, Info) ->