summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/output/mdso_create_output.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/output/mdso_create_output.c b/src/output/mdso_create_output.c
index 3eb95bc..5bbc50d 100644
--- a/src/output/mdso_create_output.c
+++ b/src/output/mdso_create_output.c
@@ -21,6 +21,7 @@ FILE * mdso_create_output(
struct mdso_driver_ctx_impl * ictx;
uintptr_t addr;
int fdout;
+ FILE * fout;
if (!dctx->cctx->dstdir)
return stdout;
@@ -33,5 +34,10 @@ FILE * mdso_create_output(
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
return 0;
- return fdopen(fdout,"w");
+ if (!(fout = fdopen(fdout,"w"))) {
+ close(fdout);
+ return 0;
+ }
+
+ return fout;
}