summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/internal/slibtool_objmeta_impl.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/internal/slibtool_objmeta_impl.c b/src/internal/slibtool_objmeta_impl.c
index 09a6c97..86ab420 100644
--- a/src/internal/slibtool_objmeta_impl.c
+++ b/src/internal/slibtool_objmeta_impl.c
@@ -57,15 +57,19 @@ static int slbt_create_compatible_object_wrapper(
struct slbt_exec_ctx * ectx)
{
int ret;
- FILE * fout;
+ int fdout;
const struct slbt_source_version * verinfo;
- if (!(fout = fopen(ectx->ltobjname,"w")))
+ if ((fdout = openat(
+ AT_FDCWD,
+ ectx->ltobjname,
+ O_RDWR|O_CREAT|O_TRUNC,
+ 0644)) < 0)
return SLBT_SYSTEM_ERROR(dctx);
verinfo = slbt_source_version();
- ret = fprintf(fout,
+ ret = slbt_dprintf(fdout,
"# %s - a libtool object file\n"
"# Generated by %s (slibtool %d.%d.%d)\n"
"# [commit reference: %s]\n"
@@ -91,9 +95,9 @@ static int slbt_create_compatible_object_wrapper(
? ectx->aobjname
: "none");
- return (ret <= 0) || fclose(fout)
- ? SLBT_SYSTEM_ERROR(dctx)
- : 0;
+ close(fdout);
+
+ return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx) : 0;
}
int slbt_create_object_wrapper(