From 8029ee113841f08454d5e826a9af23a18c0f0186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 19 Sep 2012 15:55:53 +0200 Subject: 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) --- lib/common_test/src/ct_master_logs.erl | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'lib/common_test/src') 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, - "\n", - []), - io:format(Fd, - xhtml("

Progress Log

\n
\n",
-		    "

Progress Log

\n
\n"),
-	      []),
+    io:put_chars(Fd,
+		 "\n"),
+    io:put_chars(Fd, 
+		 xhtml("

Progress Log

\n
\n",
+		       "

Progress Log

\n
\n")),
     Fd.
 
 close_ct_master_log(Fd) ->
-    io:format(Fd,"
",[]), - io:format(Fd,footer(),[]), + io:put_chars(Fd,["
",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) -> -- cgit v1.2.3