From 15ffb9ec0918b7f274612a883c1704e74dad1782 Mon Sep 17 00:00:00 2001 From: short <> Date: Tue, 9 Dec 2003 16:24:49 +0000 Subject: [PATCH] Report sandbox connection failure with sandbox-server execution suggestion for better error reporting. --- src/libcaptive/sandbox/split.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libcaptive/sandbox/split.c b/src/libcaptive/sandbox/split.c index d58c8ee..33a675e 100644 --- a/src/libcaptive/sandbox/split.c +++ b/src/libcaptive/sandbox/split.c @@ -479,6 +479,7 @@ gchar *ior,*child_chroot_pid_hashkey_dir; int errint; gchar *s,*sd,*se; gboolean errbool; +const gchar *ior_read_error; /* Initialize /tmp/orbit-$username directory for linking IOR socket. */ errbool=corba_init("captive-sandbox-parent",&captive_corba_ev,&captive_corba_orb,&captive_corba_poa); @@ -505,10 +506,19 @@ gboolean errbool; data=captive_rtl_file_read(Vfs_IOR_fd_read,&data_size); /* data_fd_read */ errint=close(Vfs_IOR_fd_read); - g_assert(errint==0); - g_assert(data!=NULL); - g_assert(data_size>=1); - g_assert(data[data_size-1]=='\n'); + ior_read_error=NULL; +#define IOR_READ_ERROR(cond) G_STMT_START { \ + if (!ior_read_error && !(cond)) \ + ior_read_error=G_STRINGIFY(cond); \ + } G_STMT_END + IOR_READ_ERROR(errint==0); + IOR_READ_ERROR(data!=NULL); + IOR_READ_ERROR(data_size>=1); + IOR_READ_ERROR(data[data_size-1]=='\n'); + if (ior_read_error) + g_error(_("Error connecting to the sandbox server (failed \"%s\"). Try running by hand: %s"), + ior_read_error,CAPTIVE_VFS_OBJECT(captive_vfs_parent_object)->options.sandbox_server_argv[0]); +#undef IOR_READ_ERROR hash=g_hash_table_new(g_str_hash,g_str_equal); -- 1.8.3.1