return;
}
+ g_unix_fd_list_append(fd_list, write_fd, &error);
+ if (error != NULL) {
+ dprintf(STDERR_FILENO, "g_unix_fd_list_append() error: %s\n", error->message);
+ goto out_close;
+ }
+
pthread_t copy_thread;
int fd_pair2[2];
fd_pair2[0] = read_fd;
fd_pair2[1] = out_fd;
if (pthread_create(©_thread, NULL, copy_data, &fd_pair2[0]) != 0) {
printf("pthread_create error: %m\n");
- return;
- }
- g_unix_fd_list_append(fd_list, write_fd, &error);
- close(write_fd);
- if (error != NULL) {
- dprintf(STDERR_FILENO, "g_unix_fd_list_append() error: %s\n", error->message);
- return;
+ goto out_unref_fdlist;
}
g_dbus_message_set_unix_fd_list(method_call_message, fd_list);
g_error_free(error);
}
- g_object_unref(fd_list);
g_object_unref(method_call_message);
g_object_unref(repl);
if (pthread_join(copy_thread, NULL) != 0)
printf("pthread_join error: %m\n");
+out_unref_fdlist:
+ g_object_unref(fd_list);
+out_close:
+ close(write_fd);
close(read_fd);
}