summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-05-07 21:16:47 -0400
committermidipix <writeonce@midipix.org>2019-05-07 21:16:47 -0400
commit6d45988d64cee1c83900da412be55b82b6d40059 (patch)
treea8e3171d9f0e17d18c4a5a87fb3a179de53aa087 /src/driver
parent4e2f5ee46ccef209c94be627669ef6dac6c9e5d5 (diff)
downloadmdso-6d45988d64cee1c83900da412be55b82b6d40059.tar.bz2
mdso-6d45988d64cee1c83900da412be55b82b6d40059.tar.xz
Do not refer to on-the-fly compound literals out of scope.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/mdso_driver_ctx.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/driver/mdso_driver_ctx.c b/src/driver/mdso_driver_ctx.c
index 59450ac..32683b6 100644
--- a/src/driver/mdso_driver_ctx.c
+++ b/src/driver/mdso_driver_ctx.c
@@ -33,6 +33,16 @@ static const struct mdso_source_version mdso_src_version = {
MDSO_GIT_VERSION
};
+/* default fd context */
+static const struct mdso_fd_ctx mdso_default_fdctx = {
+ .fdin = STDIN_FILENO,
+ .fdout = STDOUT_FILENO,
+ .fderr = STDERR_FILENO,
+ .fdcwd = AT_FDCWD,
+ .fddst = AT_FDCWD,
+ .fdlog = (-1),
+};
+
struct mdso_driver_ctx_alloc {
struct argv_meta * meta;
struct mdso_driver_ctx_impl ctx;
@@ -188,16 +198,8 @@ int mdso_get_driver_ctx(
(void)envp;
- if (!fdctx) {
- fdctx = &(const struct mdso_fd_ctx) {
- .fdin = STDIN_FILENO,
- .fdout = STDOUT_FILENO,
- .fderr = STDERR_FILENO,
- .fdlog = (-1),
- .fdcwd = AT_FDCWD,
- .fddst = AT_FDCWD,
- };
- }
+ if (!fdctx)
+ fdctx = &mdso_default_fdctx;
argv_optv_init(mdso_default_options,optv);