}
static void
-create_script_file(Eet_File *ef, const char *filename, const Code *cd)
+create_script_file(Eet_File *ef, const char *filename, const Code *cd, int fd)
{
- FILE *f = fopen(filename, "wb");
+ FILE *f = fdopen(fd, "wb");
if (!f)
error_and_abort(ef, "Unable to open temp file \"%s\" for script "
"compilation.\n", filename);
static void
compile_script_file(Eet_File *ef, const char *source, const char *output,
- int script_num)
+ int script_num, int fd)
{
FILE *f;
char buf[4096];
if (ret < 0 || ret > 1)
error_and_abort(ef, "Compiling script code not clean.\n");
- f = fopen(output, "rb");
+ f = fdopen(fd, "rb");
if (!f)
error_and_abort(ef, "Unable to open script object \"%s\" for reading.\n",
output);
error_and_abort(ef, "Unable to open temp file \"%s\" for script "
"compilation.\n", tmpn);
- create_script_file(ef, tmpn, cd);
- close(fd);
+ create_script_file(ef, tmpn, cd, fd);
snprintf(tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir);
fd = mkstemp(tmpo);
error_and_abort(ef, "Unable to open temp file \"%s\" for script "
"compilation.\n", tmpn);
}
-
- compile_script_file(ef, tmpn, tmpo, i);
- close(fd);
+ compile_script_file(ef, tmpn, tmpo, i, fd);
unlink(tmpn);
unlink(tmpo);