g_autofree gchar *server_fd = NULL;
g_autofree gchar *ctrl_fd = NULL;
g_autofree gchar *keyopts = NULL;
+ g_autofree gchar *logop = NULL;
g_autofree gchar **argv = NULL;
struct stat statbuf;
gboolean success;
argv = concat_arrays(argv, (gchar*[]){"--key", keyopts, NULL}, TRUE);
}
+ if (gl_LOGFILE != NULL) {
+ logop = g_strdup_printf("file=%s", gl_LOGFILE);
+ argv = concat_arrays(argv, (gchar*[]){"--log", logop, NULL}, TRUE);
+ }
+
if (socketpair(AF_UNIX, SOCK_STREAM, 0, self->ctrl_fds) != 0) {
logerr(self->logfile, "Could not create socketpair: %s\n", strerror(errno));
return 1;
g_autoptr(GError) error = NULL;
g_autofree gchar **argv = NULL;
g_autofree gchar *dirop = g_strdup_printf("dir=%s", tpm_state_path);
+ g_autofree gchar *logop = NULL;
g_autofree gchar **my_argv = NULL;
my_argv = concat_arrays((gchar*[]) {
if (flags & SETUP_TPM2_F)
my_argv = concat_arrays(my_argv, (gchar*[]) { "--tpm2", NULL }, TRUE);
+ if (gl_LOGFILE != NULL) {
+ logop = g_strdup_printf("file=%s", gl_LOGFILE);
+ my_argv = concat_arrays(my_argv, (gchar*[]){"--log", logop, NULL}, TRUE);
+ }
+
argv = concat_arrays(swtpm_prg_l, my_argv, FALSE);
+
success = g_spawn_sync(NULL, argv, NULL, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL,
&standard_output, NULL, &exit_status, &error);
if (!success) {
g_autoptr(GError) error = NULL;
g_autofree gchar **argv = NULL;
gchar *my_argv[] = { "--print-capabilities", NULL };
+ g_autofree gchar *logop = NULL;
argv = concat_arrays(swtpm_prg_l, my_argv, FALSE);
+
+ if (gl_LOGFILE != NULL) {
+ logop = g_strdup_printf("file=%s", gl_LOGFILE);
+ argv = concat_arrays(argv, (gchar*[]){"--log", logop, NULL}, TRUE);
+ }
+
success = g_spawn_sync(NULL, argv, NULL, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL,
&standard_output, NULL, &exit_status, &error);
if (!success) {
gchar **argv = NULL;
char *p;
int n;
+ g_autofree gchar *logop = NULL;
*n_keysizes = 0;
argv = concat_arrays(swtpm_prg_l, my_argv, FALSE);
+ if (gl_LOGFILE != NULL) {
+ logop = g_strdup_printf("file=%s", gl_LOGFILE);
+ argv = concat_arrays(argv, (gchar*[]){"--log", logop, NULL}, TRUE);
+ }
+
success = g_spawn_sync(NULL, argv, NULL, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL,
&standard_output, NULL, &exit_status, &error);
if (!success) {