summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-29 01:24:57 -0400
committermidipix <writeonce@midipix.org>2018-06-29 01:37:45 -0400
commitc5f4f43d7f8c3bcff11e576acb195c48ebb4689f (patch)
tree0bca1d461c18c2e6ee09875ae29de82aa6162206 /src
parent2c013fe31593c64a59851010320287b9ed27397a (diff)
downloadslibtool-c5f4f43d7f8c3bcff11e576acb195c48ebb4689f.tar.bz2
slibtool-c5f4f43d7f8c3bcff11e576acb195c48ebb4689f.tar.xz
internals: re-implemented slbt_create_compatible_object_wrapper() w. pure fdio.
Diffstat (limited to 'src')
-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(