#include <grp.h>
#include <pwd.h>
#include <sys/mount.h>
+#include <linux/fs.h>
#include "execute.h"
#include "strv.h"
assert(fd >= 0);
/* This might fail. What matters are the results. */
- fchown(fd, uid, -1);
- fchmod(fd, TTY_MODE);
+ (void) fchown(fd, uid, -1);
+ (void) fchmod(fd, TTY_MODE);
if (fstat(fd, &st) < 0)
return -errno;
return r;
}
-static int restore_conform_stdio(const ExecContext *context,
+static int restore_confirm_stdio(const ExecContext *context,
int *saved_stdin,
int *saved_stdout,
bool *keep_stdin,
char **argv,
const ExecContext *context,
int fds[], unsigned n_fds,
+ char **environment,
bool apply_permissions,
bool apply_chroot,
bool confirm_spawn,
}
/* Release terminal for the question */
- if ((r = restore_conform_stdio(context,
+ if ((r = restore_confirm_stdio(context,
&saved_stdin, &saved_stdout,
&keep_stdin, &keep_stdout)))
goto fail;
goto fail;
}
- if (!(final_env = strv_env_merge(environ, our_env, context->environment, NULL))) {
+ assert(n_env <= 6);
+
+ if (!(final_env = strv_env_merge(environment, our_env, context->environment, NULL))) {
r = EXIT_MEMORY;
goto fail;
}
* sure that when we kill the cgroup the process will be
* killed too). */
if (cgroup_bondings)
- if ((r = cgroup_bonding_install_list(cgroup_bondings, pid)) < 0) {
- r = EXIT_CGROUP;
- goto fail;
- }
+ cgroup_bonding_install_list(cgroup_bondings, pid);
log_debug("Forked %s as %llu", command->path, (unsigned long long) pid);