ust_fork(): close the ustcomm_app socket in the child on fork()
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Sat, 27 Feb 2010 17:12:59 +0000 (12:12 -0500)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Sat, 27 Feb 2010 17:12:59 +0000 (12:12 -0500)
This fixes a bug where the parent's connections remained jammed open.

libust/tracectl.c
libustcomm/ustcomm.c
libustcomm/ustcomm.h

index 220d37f6f0bb347b22587c98bbcee6ee6e0857cf..848b272f77c5167de00828e88b67652472ada7f7 100644 (file)
@@ -1478,6 +1478,8 @@ static void ust_fork(void)
                list_del(&bc->list);
        }
 
+       ustcomm_free_app(&ustcomm_app);
+
        buffers_to_export = 0;
        have_listener = 0;
        init_socket();
index 7dd12510612eac2b1502445f6d9cfd64e89c9102..5f2517b169411dc24e2f66c6823962d629ebfdc4 100644 (file)
@@ -678,6 +678,16 @@ free_name:
        return -1;
 }
 
+void ustcomm_free_app(struct ustcomm_app *app)
+{
+       int result;
+       result = close(app->server.listen_fd);
+       if(result == -1) {
+               PERROR("close");
+               return;
+       }
+}
+
 /* Used by the daemon to initialize its server so applications
  * can connect to it.
  */
index a554678c999c9284e84740ac72a35d35900fd8eb..05d90ebc0f02c2bd2634024d6824f398b098e77b 100644 (file)
@@ -68,6 +68,7 @@ extern int ustcomm_app_recv_message(struct ustcomm_app *app, char **msg, struct
 
 extern int ustcomm_init_app(pid_t pid, struct ustcomm_app *handle);
 extern void ustcomm_fini_app(struct ustcomm_app *handle);
+extern void ustcomm_free_app(struct ustcomm_app *app);
 
 extern int ustcomm_init_ustd(struct ustcomm_ustd *handle, const char *sock_path);
 
This page took 0.02584 seconds and 4 git commands to generate.