speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Correctly use execlp to specify module image name.


From: Boris Dušek
Subject: [PATCH] Correctly use execlp to specify module image name.
Date: Fri, 18 Mar 2011 22:58:12 +0100

The first argument to the execlp function is the filename of the file
containing the executable image that will be loaded by the dynamic
loader. The second argument to the function then seems redundant, since
it should be the same as the first argument (since it is what gets
passed as argv[0] to the resulting program). But it can be different
from the first argument, e.g. when launching a shell script: then the
first argument will be e.g. /bin/sh, since that is the executable image
file from the view of the operating system, but the second argument
(i.e. argv[0]) will be the name of the shell script (e.g. script.sh).
Therefore it makes sense to specify the same for the first and second
argument when no interpreter is in place.

This fixes display using ps aux - the module processes launched by
speech-dispatcher main process had empty COMMAND field, making them
hardly identifiable for user inspecting running processes.
---
 src/server/module.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/server/module.c b/src/server/module.c
index dc60f87..9fe6a6f 100644
--- a/src/server/module.c
+++ b/src/server/module.c
@@ -216,12 +216,12 @@ OutputModule *load_output_module(char *mod_name, char 
*mod_prog,
                }
 
                if (cfg == 0) {
-                       if (execlp(module->filename, "", (char *)0) == -1) {
+                       if (execlp(module->filename, module->filename, (char 
*)0) == -1) {
                                exit(1);
                        }
                } else {
-                       //if (execlp("valgrind", "" ,"--trace-children=yes", 
module->filename, arg1, arg2, (char *) 0) == -1){
-                       if (execlp(module->filename, "", arg1, (char *)0) == 
-1) {
+                       //if (execlp("valgrind", "valgrind" 
,"--trace-children=yes", module->filename, arg1, arg2, (char *) 0) == -1){
+                       if (execlp(module->filename, module->filename, arg1, 
(char *)0) == -1) {
                                exit(1);
                        }
                }
-- 
1.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]