X-Git-Url: https://harishankar.org/repos/?p=biaweb2.git;a=blobdiff_plain;f=biawebutil.hpp;h=c8603ea106530e7cdc55e52168cc8a0d7e8827e9;hp=6a878271b40e20bb4a0e6df4cb2da876884f9881;hb=44d5fb1ff24147859c5f198dd47f6956ec5fea51;hpb=26b38b4a38c24955293a7144f1e1d74676601caf diff --git a/biawebutil.hpp b/biawebutil.hpp index 6a87827..c8603ea 100644 --- a/biawebutil.hpp +++ b/biawebutil.hpp @@ -25,8 +25,8 @@ namespace biaweb { doc = mkd_string (str.c_str(), str.size(), 0); char tempfile[20]; strcpy (tempfile, "/tmp/biawebXXXXXX"); - mkstemp (tempfile); - FILE *f = fopen (tempfile, "w"); + int fd = mkstemp (tempfile); + FILE *f = fdopen (fd, "w"); markdown (doc, f, 0); fclose (f); std::ifstream ftmp (tempfile); @@ -35,6 +35,7 @@ namespace biaweb { ); ftmp.close (); mkd_cleanup (doc); + remove (tempfile); return tmpl; }