diff --git a/obexd/plugins/filesystem.c b/obexd/plugins/filesystem.c
index 6c860cb..ffed561 100644
--- a/obexd/plugins/filesystem.c
+++ b/obexd/plugins/filesystem.c
char buf[128];
object->pid = -1;
+ object->watch = 0;
+
+ DBG("pid: %d status: %d", pid, status);
if (WEXITSTATUS(status) != EXIT_SUCCESS) {
memset(buf, 0, sizeof(buf));
return -EPERM;
}
+ DBG("executing %s pid %d", argv[0], pid);
+
return pid;
}
static int capability_close(void *object)
{
struct capability_object *obj = object;
+ int err = 0;
+
+ if (obj->pid < 0)
+ goto done;
- if (obj->pid >= 0) {
+ if (obj->watch)
g_source_remove(obj->watch);
- kill(obj->pid, SIGTERM);
- g_spawn_close_pid(obj->pid);
+
+ g_spawn_close_pid(obj->pid);
+
+ DBG("kill: pid %d", obj->pid);
+ err = kill(obj->pid, SIGTERM);
+ if (err < 0) {
+ err = -errno;
+ error("kill: %s (%d)", strerror(-err), -err);
}
+done:
if (obj->buffer != NULL)
g_string_free(obj->buffer, TRUE);
g_free(obj);
- return 0;
+ return err;
}
static struct obex_mime_type_driver file = {