summaryrefslogtreecommitdiff
path: root/src/driver/slbt_driver_ctx.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-05-07 21:28:50 -0400
committermidipix <writeonce@midipix.org>2019-05-07 21:30:32 -0400
commit35803045ff749222ab31e3c3312b5c5a3994c412 (patch)
tree7977c0780fc383b07fffc34dc2209a9244e20099 /src/driver/slbt_driver_ctx.c
parent1bd7a315100f6ae9fd6254a1fefdbc5edd9ff550 (diff)
downloadslibtool-35803045ff749222ab31e3c3312b5c5a3994c412.tar.bz2
slibtool-35803045ff749222ab31e3c3312b5c5a3994c412.tar.xz
Do not refer to on-the-fly compound literals out of scope.
Diffstat (limited to 'src/driver/slbt_driver_ctx.c')
-rw-r--r--src/driver/slbt_driver_ctx.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 4ff364b..098ff48 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -32,6 +32,16 @@ static const struct slbt_source_version slbt_src_version = {
SLIBTOOL_GIT_VERSION
};
+/* default fd context */
+static const struct slbt_fd_ctx slbt_default_fdctx = {
+ .fdin = STDIN_FILENO,
+ .fdout = STDOUT_FILENO,
+ .fderr = STDERR_FILENO,
+ .fdcwd = AT_FDCWD,
+ .fddst = AT_FDCWD,
+ .fdlog = (-1),
+};
+
/* flavor settings */
#define SLBT_FLAVOR_SETTINGS(flavor, \
bfmt,pic, \
@@ -1223,16 +1233,8 @@ int slbt_get_driver_ctx(
argv_optv_init(slbt_default_options,optv);
- if (!fdctx) {
- fdctx = &(const struct slbt_fd_ctx) {
- .fdin = STDIN_FILENO,
- .fdout = STDOUT_FILENO,
- .fderr = STDERR_FILENO,
- .fdlog = (-1),
- .fdcwd = AT_FDCWD,
- .fddst = AT_FDCWD,
- };
- }
+ if (!fdctx)
+ fdctx = &slbt_default_fdctx;
sargv.dargs = 0;
sargv.dargv = 0;