diff options
author | Mattias Andrée <maandree@kth.se> | 2024-05-05 17:56:50 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2024-05-05 17:59:12 +0200 |
commit | 924f443d62bfabf8761da31ed890791d5893463a (patch) | |
tree | aa544535fca95a653844aea8d233b2450246d88a /libexec_putenv.c | |
parent | First commit (diff) | |
download | libexec-924f443d62bfabf8761da31ed890791d5893463a.tar.gz libexec-924f443d62bfabf8761da31ed890791d5893463a.tar.bz2 libexec-924f443d62bfabf8761da31ed890791d5893463a.tar.xz |
libexec_init_command was a huge oversight, it cannot be used
as it would set .library_version to the libraries version of
LIBEXEC_VERSION rather than the application's; instead
LIBEXEC_COMMAND_INIT should be used.
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libexec_putenv.c')
-rw-r--r-- | libexec_putenv.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libexec_putenv.c b/libexec_putenv.c index 366f5fb..c72a153 100644 --- a/libexec_putenv.c +++ b/libexec_putenv.c @@ -79,12 +79,9 @@ libexec_putenv(struct libexec_command *cmd, enum libexec_insert_mode how, const } if (how == LIBEXEC_NOREPLACE || !strcmp(env[i], string)) { - if (!cmd->environ) { - if (libexec_copy_environ(cmd, NULL)) { - free(copy); + if (!cmd->environ) + if (libexec_copy_environ(cmd, NULL)) return -1; - } - } return 0; } if (how == LIBEXEC_NOCLOBBER) @@ -124,7 +121,7 @@ main(void) struct libexec_command cmd, ref; - libexec_init_command(&cmd); + cmd = LIBEXEC_COMMAND_INIT; memcpy(&ref, &cmd, sizeof(cmd)); errno = 0; |