summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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(