diff options
author | Björn Gustavsson <[email protected]> | 2012-09-19 15:55:53 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-09-20 11:16:52 +0200 |
commit | 8029ee113841f08454d5e826a9af23a18c0f0186 (patch) | |
tree | 1b6ee1ccc84d95304f6f6bf92d9c8c12df6af424 | |
parent | a0c65862e8beaca2d2c0b9d6d13eca862641994c (diff) | |
download | otp-8029ee113841f08454d5e826a9af23a18c0f0186.tar.gz otp-8029ee113841f08454d5e826a9af23a18c0f0186.tar.bz2 otp-8029ee113841f08454d5e826a9af23a18c0f0186.zip |
ct_master_logs: Don't use io:format/3 with an empty variable list
It is bad practice to use an arbitrary string as a format
string for io:format(), since it could contain a '~' character
which could trigger a badarg exception. Therefore, replace all
io:format/3 calls that looks like:
io:format(Fd, String, [])
with:
io:put_chars(Fd, String)
-rw-r--r-- | lib/common_test/src/ct_master_logs.erl | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/common_test/src/ct_master_logs.erl b/lib/common_test/src/ct_master_logs.erl index 1e65337241..d76288feef 100644 --- a/lib/common_test/src/ct_master_logs.erl +++ b/lib/common_test/src/ct_master_logs.erl @@ -134,7 +134,7 @@ init(Parent,LogDir,Nodes) -> io:format(CtLogFd,int_header(),[log_timestamp(now()),"Test Nodes\n"]), io:format(CtLogFd,"~s\n",[NodeStr]), - io:format(CtLogFd,int_footer()++"\n",[]), + io:put_chars(CtLogFd,[int_footer(),"\n"]), NodeDirIxFd = open_nodedir_index(RunDirAbs,Time), Parent ! {started,self(),{Time,RunDirAbs}}, @@ -202,24 +202,21 @@ loop(State) -> open_ct_master_log(Dir) -> FullName = filename:join(Dir,?ct_master_log_name), {ok,Fd} = file:open(FullName,[write]), - io:format(Fd,header("Common Test Master Log", {[],[1,2],[]}),[]), + io:put_chars(Fd,header("Common Test Master Log", {[],[1,2],[]})), %% maybe add config info here later io:put_chars(config_table([])), - io:format(Fd, - "<style>\n" - "div.ct_internal { background:lightgrey; color:black }\n" - "div.default { background:lightgreen; color:black }\n" - "</style>\n", - []), - io:format(Fd, - xhtml("<br><h2>Progress Log</h2>\n<pre>\n", - "<br /><h2>Progress Log</h2>\n<pre>\n"), - []), + io:put_chars(Fd, + "<style>\n" + "div.ct_internal { background:lightgrey; color:black }\n" + "div.default { background:lightgreen; color:black }\n" + "</style>\n"), + io:put_chars(Fd, + xhtml("<br><h2>Progress Log</h2>\n<pre>\n", + "<br /><h2>Progress Log</h2>\n<pre>\n")), Fd. close_ct_master_log(Fd) -> - io:format(Fd,"</pre>",[]), - io:format(Fd,footer(),[]), + io:put_chars(Fd,["</pre>",footer()]), file:close(Fd). config_table(Vars) -> @@ -248,7 +245,7 @@ int_footer() -> open_nodedir_index(Dir,StartTime) -> FullName = filename:join(Dir,?nodedir_index_name), {ok,Fd} = file:open(FullName,[write]), - io:format(Fd,nodedir_index_header(StartTime),[]), + io:put_chars(Fd,nodedir_index_header(StartTime)), Fd. print_nodedir(Node,RunDir,Fd) -> @@ -261,7 +258,7 @@ print_nodedir(Node,RunDir,Fd) -> ok. close_nodedir_index(Fd) -> - io:format(Fd,index_footer(),[]), + io:put_chars(Fd,index_footer()), file:close(Fd). nodedir_index_header(StartTime) -> |