diff options
author | midipix <writeonce@midipix.org> | 2019-05-07 21:16:47 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2019-05-07 21:16:47 -0400 |
commit | 6d45988d64cee1c83900da412be55b82b6d40059 (patch) | |
tree | a8e3171d9f0e17d18c4a5a87fb3a179de53aa087 /src | |
parent | 4e2f5ee46ccef209c94be627669ef6dac6c9e5d5 (diff) | |
download | mdso-6d45988d64cee1c83900da412be55b82b6d40059.tar.bz2 mdso-6d45988d64cee1c83900da412be55b82b6d40059.tar.xz |
Do not refer to on-the-fly compound literals out of scope.
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/mdso_driver_ctx.c | 22 |
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); |