fopen can fail. check file is open before trying to write to it.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-08-05 10:41:16 +01:00
parent 62401c257a
commit 42496ac4ea
1 changed files with 7 additions and 4 deletions

View File

@ -438,10 +438,13 @@ output(void)
ERR("potential security violation. attempt to write in parent dir.");
exit (-1);
}
f = fopen(out, "wb");
fprintf(f, "#!/bin/sh\n");
fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, sf->name, outdir);
fclose(f);
if ((f = fopen(out, "wb")))
{
fprintf(f, "#!/bin/sh\n");
fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n",
edje_file->compiler, sf->name, outdir);
fclose(f);
}
WRN("*** CAUTION ***\n"
"Please check the build script for anything malicious "