#include "captive/macros.h"
-static GnomeVFSResult captive_sandbox_parent_vfs_new_silent(CaptiveVfsParentObject *captive_vfs_parent_object)
+GnomeVFSResult captive_sandbox_parent_vfs_new_silent(CaptiveVfsParentObject *captive_vfs_parent_object)
{
gboolean errbool;
if (captive_vfs_parent_object->corba_bug_action) {
xmlNode *xml_action;
- xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"vfs_new",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_vfs_parent_object));
+ xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "vfs_new",NULL);
+ xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_vfs_parent_object));
}
return r;
case CAPTIVE_OPTION_MEDIA_DISK: xml_media_type="disk"; break;
default: g_assert_not_reached();
}
- xmlNewProp(xml_media,"type",xml_media_type);
+ xmlNewProp(xml_media,BAD_CAST "type",BAD_CAST xml_media_type);
xmlSetDocCompressMode(captive_vfs_parent_object->corba_bug_doc,9);
Captive_Vfs_shutdown(captive_vfs_parent_object->corba_Vfs_object,&captive_corba_ev);
r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
+ /* We may get called by recursion from captive_sandbox_parent_return_from_CORBA_Environment(): */
+ if (captive_vfs_parent_object->corba_Vfs_object==CORBA_OBJECT_NIL)
+ return r;
+
/* Always clear 'corba_Vfs_object' even if 'r' means failure. */
CORBA_Object_release(captive_vfs_parent_object->corba_Vfs_object,&captive_corba_ev);
g_assert(validate_CORBA_Environment(&captive_corba_ev));
g_return_val_if_fail(errint==0,FALSE);
}
+ /* Cleanup linked child socket to our parent '/tmp'. */
+ if (captive_vfs_parent_object->corba_chrooted_orbit_dir) {
+ if (captive_vfs_parent_object->corba_socketname) {
+const gchar *socketpathname;
+
+ socketpathname=captive_printf_alloca("%s/%s",
+ captive_vfs_parent_object->corba_chrooted_orbit_dir,captive_vfs_parent_object->corba_socketname);
+ unlink(socketpathname); /* errors ignored */
+ g_free(captive_vfs_parent_object->corba_socketname);
+ captive_vfs_parent_object->corba_socketname=NULL;
+ }
+ rmdir(captive_vfs_parent_object->corba_chrooted_orbit_dir); /* errors ignored */
+ g_free(captive_vfs_parent_object->corba_chrooted_orbit_dir);
+ captive_vfs_parent_object->corba_chrooted_orbit_dir=NULL;
+ }
+
/* Cleanup the child process. */
if (captive_vfs_parent_object->corba_child_pid!=(pid_t)-1) {
kill(captive_vfs_parent_object->corba_child_pid,SIGKILL); /* errors ignored */
/* waitpid(2) errors are ignored as we should be immune against failures as the parent. */
waitpid(captive_vfs_parent_object->corba_child_pid,
NULL, /* status */
- WNOHANG); /* options */
+ /* options: !WNOHANG as the child will not be ready yet for waitpid()
+ * right after its SIGKILL. As we did SIGKILL I hope it has no chance
+ * to block us.
+ */
+ 0); /* options */
}
if (r==GNOME_VFS_OK) {
if (captive_vfs_parent_object->corba_bug_action) {
xmlNode *xml_action;
- xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"vfs_close",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_vfs_parent_object));
+ xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "vfs_close",NULL);
+ xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_vfs_parent_object));
}
return captive_sandbox_parent_vfs_close_silent(captive_vfs_parent_object);
g_return_val_if_fail(captive_vfs_parent_object->corba_Vfs_object!=CORBA_OBJECT_NIL,GNOME_VFS_ERROR_BAD_PARAMETERS);
if (captive_vfs_parent_object->corba_bug_action) {
- xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"vfs_commit",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_vfs_parent_object));
+ xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "vfs_commit",NULL);
+ xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_vfs_parent_object));
}
r_close=captive_vfs_parent_object_disconnect(captive_vfs_parent_object);
r_new=GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
if (captive_vfs_parent_object->corba_bug_action) {
- xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"vfs_commit",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_vfs_parent_object));
- xmlNewProp(xml_action,"result_prev_close",gnome_vfs_result_to_string(r_close));
- xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r_new));
+ xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "vfs_commit",NULL);
+ xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_vfs_parent_object));
+ xmlNewProp(xml_action,BAD_CAST "result_prev_close",BAD_CAST gnome_vfs_result_to_string(r_close));
+ xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r_new));
}
return (r_new!=GNOME_VFS_OK ? r_new : r_close);
g_return_val_if_fail(volume_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
if (captive_vfs_parent_object->corba_bug_action) {
- xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"vfs_volume_info_get",NULL);
- xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_vfs_parent_object));
+ xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "vfs_volume_info_get",NULL);
+ xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_vfs_parent_object));
}
Captive_Vfs_volume_info_get(captive_vfs_parent_object->corba_Vfs_object,&volume_info_corba,&captive_corba_ev);
if (xml_action)
- xmlNewProp(xml_action,"result",(captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
+ xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST (captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
if (xml_action)
- xmlSetProp(xml_action,"result",gnome_vfs_result_to_string(r));
+ xmlSetProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
if (r!=GNOME_VFS_OK)
return r;