aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_asm.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-23 07:00:34 +0100
committerBjörn Gustavsson <[email protected]>2016-03-24 15:44:20 +0100
commitafff8b0fd74fda09ba8dc5f7bfe95b5cb345872e (patch)
tree3f1c23166a61dbc82b5e1287e7af91a73ec4be45 /lib/compiler/src/beam_asm.erl
parent41d29391df8857a9645bd5b5889f5db5f5a7529c (diff)
downloadotp-afff8b0fd74fda09ba8dc5f7bfe95b5cb345872e.tar.gz
otp-afff8b0fd74fda09ba8dc5f7bfe95b5cb345872e.tar.bz2
otp-afff8b0fd74fda09ba8dc5f7bfe95b5cb345872e.zip
Fix compile:forms/1,2 crash when not in an existing directory
compile:forms/1,2 will crash when the current working directory has been deleted. Fix that problem, and while we are at it, also stop including {source,""} in module_info() when no source code file is given. Reported-at: http://bugs.erlang.org/browse/ERL-113 Reported-by: Adam Lindberg
Diffstat (limited to 'lib/compiler/src/beam_asm.erl')
-rw-r--r--lib/compiler/src/beam_asm.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_asm.erl b/lib/compiler/src/beam_asm.erl
index 95be471de3..28fd061bdc 100644
--- a/lib/compiler/src/beam_asm.erl
+++ b/lib/compiler/src/beam_asm.erl
@@ -225,10 +225,14 @@ flatten_imports(Imps) ->
list_to_binary(map(fun({M,F,A}) -> <<M:32,F:32,A:32>> end, Imps)).
build_attributes(Opts, SourceFile, Attr, MD5) ->
+ Misc0 = case SourceFile of
+ [] -> [];
+ [_|_] -> [{source,SourceFile}]
+ end,
Misc = case member(slim, Opts) of
false ->
{{Y,Mo,D},{H,Mi,S}} = erlang:universaltime(),
- [{time,{Y,Mo,D,H,Mi,S}},{source,SourceFile}];
+ [{time,{Y,Mo,D,H,Mi,S}}|Misc0];
true -> []
end,
Compile = [{options,Opts},{version,?COMPILER_VSN}|Misc],