nsm-proxy: Don't die if arguments are missing.

This commit is contained in:
Jonathan Moore Liles 2012-04-10 16:04:55 -07:00
parent 679e33d729
commit 16f8956f8d
2 changed files with 12 additions and 2 deletions

View File

@ -105,6 +105,9 @@ handle_kill ( Fl_Widget *o, void *v )
void void
handle_start ( Fl_Widget *o, void *v ) handle_start ( Fl_Widget *o, void *v )
{ {
lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/label", "s",
ui->label_input->value() );
lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/start", "ss", lo_send_from( nsmp_addr, losrv, LO_TT_IMMEDIATE, "/nsm/proxy/start", "ss",
ui->executable_input->value(), ui->executable_input->value(),
ui->arguments_input->value() ); ui->arguments_input->value() );

View File

@ -87,7 +87,11 @@ public:
free( _arguments ); free( _arguments );
_executable = strdup( executable ); _executable = strdup( executable );
if ( arguments )
_arguments = strdup( arguments ); _arguments = strdup( arguments );
else
_arguments = NULL;
return start(); return start();
} }
@ -106,7 +110,10 @@ public:
// char *args[] = { strdup( executable ), NULL }; // char *args[] = { strdup( executable ), NULL };
char *cmd; char *cmd;
if ( _arguments )
asprintf( &cmd, "exec %s %s", _executable, _arguments ); asprintf( &cmd, "exec %s %s", _executable, _arguments );
else
asprintf( &cmd, "exec %s", _executable );
char *args[] = { _executable, "-c", cmd, NULL }; char *args[] = { _executable, "-c", cmd, NULL };