summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-29 01:19:55 -0400
committermidipix <writeonce@midipix.org>2018-06-29 01:37:44 -0400
commit45a19f7285ca020a2fd3cc095c41c78055c949e6 (patch)
treeb53ac6ce69bad776590b4789dc7f9f7ed3d2e94e
parenta53a8bf83e839632f938e975ead77d3ef97d7416 (diff)
downloadslibtool-45a19f7285ca020a2fd3cc095c41c78055c949e6.tar.bz2
slibtool-45a19f7285ca020a2fd3cc095c41c78055c949e6.tar.xz
internals: re-implemented slbt_create_compatible_library_wrapper() w. pure fdio.
-rw-r--r--src/internal/slibtool_libmeta_impl.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/internal/slibtool_libmeta_impl.c b/src/internal/slibtool_libmeta_impl.c
index bc4fca2..c1366d9 100644
--- a/src/internal/slibtool_libmeta_impl.c
+++ b/src/internal/slibtool_libmeta_impl.c
@@ -135,7 +135,7 @@ static int slbt_create_compatible_library_wrapper(
char * solnk)
{
int ret;
- FILE * fout;
+ int fdout;
const char * base;
bool fnover;
bool fvernum;
@@ -147,7 +147,11 @@ static int slbt_create_compatible_library_wrapper(
(void)ectx;
/* create */
- if (!(fout = fopen(dctx->cctx->output,"w")))
+ if ((fdout = openat(
+ AT_FDCWD,
+ dctx->cctx->output,
+ O_RDWR|O_CREAT|O_TRUNC,
+ 0644)) < 0)
return SLBT_SYSTEM_ERROR(dctx);
/* version info */
@@ -171,7 +175,7 @@ static int slbt_create_compatible_library_wrapper(
verinfo = slbt_source_version();
/* wrapper content */
- ret = fprintf(fout,
+ ret = slbt_dprintf(fdout,
"# %s - a libtool library file\n"
"# Generated by %s (slibtool %d.%d.%d)\n"
"# [commit reference: %s]\n"
@@ -256,9 +260,9 @@ static int slbt_create_compatible_library_wrapper(
/* libdir */
dctx->cctx->rpath ? dctx->cctx->rpath : "");
- return (ret <= 0) || fclose(fout)
- ? SLBT_SYSTEM_ERROR(dctx)
- : 0;
+ close(fdout);
+
+ return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx) : 0;
}
int slbt_create_library_wrapper(