forked from enlightenment/efl
From: Vincent Torri <vtorri@univ-evry.fr>
Subject: [E-devel] Edje: using fdopen instead of fopen in edje_cc On windows, using open() followed by fopen() does not work. Hence, in edje_cc, where mkstemp (which uses open) is followed by fopen, edje_cc fails. Instead of fopen, we can use fdopen. I pasted a patch below. Can you comment it (like, instead of keeping the filename in the function that i modified, why not using it for the fd? (changes - closefd) removed from data_write_scripts() as fclose() handles that) SVN revision: 60299
This commit is contained in:
parent
9155b5633f
commit
36b21249d9
|
@ -708,9 +708,9 @@ data_write_groups(Eet_File *ef, int *collection_num)
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -787,7 +787,7 @@ create_script_file(Eet_File *ef, const char *filename, const Code *cd)
|
|||
|
||||
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];
|
||||
|
@ -802,7 +802,7 @@ compile_script_file(Eet_File *ef, const char *source, const char *output,
|
|||
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);
|
||||
|
@ -864,8 +864,7 @@ data_write_scripts(Eet_File *ef)
|
|||
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);
|
||||
|
@ -875,9 +874,7 @@ data_write_scripts(Eet_File *ef)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue