Skip to content
Snippets Groups Projects
Commit db8ee02e authored by Moe Jette's avatar Moe Jette
Browse files

Treat MaxTime in partition configuration as a string to accept "INFINITE"

as a valid value.
parent 69768cdd
No related branches found
No related tags found
No related merge requests found
...@@ -432,19 +432,15 @@ static int _parse_node_spec(char *in_line) ...@@ -432,19 +432,15 @@ static int _parse_node_spec(char *in_line)
*/ */
static int _parse_part_spec(char *in_line) static int _parse_part_spec(char *in_line)
{ {
char *allow_groups, *nodes, *partition_name; char *allow_groups = NULL, *nodes = NULL, *partition_name = NULL;
char *default_str, *root_str, *shared_str, *state_str; char *max_time_str = NULL, *default_str = NULL, *root_str = NULL;
int max_time_val, max_nodes_val, min_nodes_val; char *shared_str = NULL, *state_str = NULL;
int root_val, default_val; int max_time_val = NO_VAL, max_nodes_val = NO_VAL;
int state_val, shared_val; int min_nodes_val = NO_VAL, root_val = NO_VAL, default_val = NO_VAL;
int state_val = NO_VAL, shared_val = NO_VAL;
int error_code; int error_code;
struct part_record *part_record_point; struct part_record *part_record_point;
partition_name = (char *) NULL;
default_str = shared_str = state_str = (char *) NULL;
max_time_val = max_nodes_val = root_val = default_val = state_val =
shared_val = NO_VAL;
if ((error_code = if ((error_code =
load_string(&partition_name, "PartitionName=", in_line))) load_string(&partition_name, "PartitionName=", in_line)))
return error_code; return error_code;
...@@ -464,7 +460,7 @@ static int _parse_part_spec(char *in_line) ...@@ -464,7 +460,7 @@ static int _parse_part_spec(char *in_line)
"AllowGroups=", 's', &allow_groups, "AllowGroups=", 's', &allow_groups,
"Default=", 's', &default_str, "Default=", 's', &default_str,
"RootOnly=", 's', &root_str, "RootOnly=", 's', &root_str,
"MaxTime=", 'd', &max_time_val, "MaxTime=", 's', &max_time_str,
"MaxNodes=", 'd', &max_nodes_val, "MaxNodes=", 'd', &max_nodes_val,
"MinNodes=", 'd', &min_nodes_val, "MinNodes=", 'd', &min_nodes_val,
"Nodes=", 's', &nodes, "Nodes=", 's', &nodes,
...@@ -504,6 +500,21 @@ static int _parse_part_spec(char *in_line) ...@@ -504,6 +500,21 @@ static int _parse_part_spec(char *in_line)
xfree(root_str); xfree(root_str);
} }
if (max_time_str) {
if (strcasecmp(max_time_str, "INFINITE") == 0)
max_time_val = INFINITE;
else {
char *end_ptr;
max_time_val = strtol(max_time_str, &end_ptr, 10);
if ((max_time_str[0] != '\0') &&
(end_ptr[0] != '\0')) {
error_code = EINVAL;
goto cleanup;
}
}
xfree(max_time_str);
}
if (shared_str) { if (shared_str) {
if (strcasecmp(shared_str, "YES") == 0) if (strcasecmp(shared_str, "YES") == 0)
shared_val = SHARED_YES; shared_val = SHARED_YES;
...@@ -615,6 +626,7 @@ static int _parse_part_spec(char *in_line) ...@@ -615,6 +626,7 @@ static int _parse_part_spec(char *in_line)
cleanup: cleanup:
xfree(allow_groups); xfree(allow_groups);
xfree(default_str); xfree(default_str);
xfree(max_time_str);
xfree(root_str); xfree(root_str);
xfree(nodes); xfree(nodes);
xfree(partition_name); xfree(partition_name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment