Skip to content

Commit

Permalink
mxqsub: Disallow whitespace in command or command-alias
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Aug 11, 2015
1 parent 560ac98 commit b69a01c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions mxqsub.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,10 @@ int main(int argc, char *argv[])

case 'a':
p = strchr(optctl.optarg, ' ');
if (p)
*p = 0;
if (p) {
mx_log_crit("--command-alias '%s': String contains whitespace characters.", optctl.optarg);
exit(EX_CONFIG);
}
if (!(*optctl.optarg)) {
mx_log_crit("--command-alias '%s': String is empty.", optctl.optarg);
exit(EX_CONFIG);
Expand Down Expand Up @@ -647,6 +649,15 @@ int main(int argc, char *argv[])

/* from this point values in argc,argv are the ones of the cluster job */

if (!arg_program_name) {
p = strchr(argv[0], ' ');
if (p) {
mx_log_crit("<command> contains whitespace characters. Please set --command-alias if this is intended.", optctl.optarg);
exit(EX_CONFIG);
}
arg_program_name = argv[0];
}

if (!arg_time) {
arg_time = 15;
mx_log_warning("option '--runtime' or '-t' not used. Your job will get killed if it runs longer than the default of %d minutes.", arg_time);
Expand All @@ -656,9 +667,6 @@ int main(int argc, char *argv[])
mx_log_warning("option '--runtime' specifies a runtime longer than 24h. Your job may get killed. Be sure to implement some check pointing.");
}

if (!arg_program_name)
arg_program_name = argv[0];

if (!(*arg_program_name)) {
mx_log_crit("<command> is empty. Please check usage with '%s --help'.", program_invocation_short_name);
exit(EX_CONFIG);
Expand Down

0 comments on commit b69a01c

Please sign in to comment.