From 68150aefd77ad56f00fc37bc541ab476122b138a Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Tue, 15 Jul 2008 22:44:14 +0000
Subject: [PATCH] fixed some issues with qos strings not being handled
 correctly

---
 src/sacctmgr/account_functions.c | 10 ----------
 src/sacctmgr/common.c            |  6 ++++--
 src/sacctmgr/user_functions.c    | 10 +---------
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/src/sacctmgr/account_functions.c b/src/sacctmgr/account_functions.c
index 1e50345fdf1..0cb7d1c7557 100644
--- a/src/sacctmgr/account_functions.c
+++ b/src/sacctmgr/account_functions.c
@@ -128,11 +128,6 @@ static int _set_cond(int *start, int argc, char *argv[],
 					db_conn, NULL);
 			}
 			
-			if(end > 2 && argv[i][end-1] == '='
-			   && (argv[i][end-2] == '+' 
-			       || argv[i][end-2] == '-'))
-				option = (int)argv[i][end-2];
-
 			addto_qos_char_list(acct_cond->qos_list, qos_list,
 					    argv[i]+end, option);
 			u_set = 1;
@@ -330,11 +325,6 @@ extern int sacctmgr_add_account(int argc, char *argv[])
 				qos_list = acct_storage_g_get_qos(
 					db_conn, NULL);
 			}
-			if(end > 2 && argv[i][end-1] == '='
-			   && (argv[i][end-2] == '+' 
-			       || argv[i][end-2] == '-'))
-				option = (int)argv[i][end-2];
-
 			addto_qos_char_list(add_qos_list, qos_list,
 					    argv[i]+end, option);
 		} else {
diff --git a/src/sacctmgr/common.c b/src/sacctmgr/common.c
index 159e0e00736..55efdb18414 100644
--- a/src/sacctmgr/common.c
+++ b/src/sacctmgr/common.c
@@ -559,7 +559,6 @@ extern void addto_qos_char_list(List char_list, List qos_list, char *names,
 		debug2("No real qos_list");
 		return;
 	}
-	info("got option of %c", option);
 
 	itr = list_iterator_create(char_list);
 	if(names) {
@@ -682,7 +681,7 @@ extern void sacctmgr_print_qos_list(print_field_t *field, List qos_list,
 	char *print_this = NULL;
 
 	print_this = get_qos_complete_str(qos_list, value);
-		
+	
 	if(print_fields_parsable_print)
 		printf("%s|", print_this);
 	else {
@@ -725,6 +724,9 @@ extern char *get_qos_complete_str(List qos_list, List num_qos_list)
 	list_iterator_destroy(itr);
 	list_destroy(temp_list);
 
+	if(!print_this)
+		return xstrdup("normal");
+
 	return print_this;
 }
 
diff --git a/src/sacctmgr/user_functions.c b/src/sacctmgr/user_functions.c
index 7fa99db8767..8cc266a98b0 100644
--- a/src/sacctmgr/user_functions.c
+++ b/src/sacctmgr/user_functions.c
@@ -135,11 +135,6 @@ static int _set_cond(int *start, int argc, char *argv[],
 					db_conn, NULL);
 			}
 
-			if(end > 2 && argv[i][end-1] == '='
-			   && (argv[i][end-2] == '+' 
-			       || argv[i][end-2] == '-'))
-				option = (int)argv[i][end-2];
-
 			addto_qos_char_list(user_cond->qos_list, qos_list,
 					    argv[i]+end, option);
 			u_set = 1;
@@ -238,6 +233,7 @@ static int _set_rec(int *start, int argc, char *argv[],
 				qos_list = acct_storage_g_get_qos(
 					db_conn, NULL);
 			}
+
 			if(end > 2 && argv[i][end-1] == '='
 			   && (argv[i][end-2] == '+' 
 			       || argv[i][end-2] == '-'))
@@ -371,10 +367,6 @@ extern int sacctmgr_add_user(int argc, char *argv[])
 				qos_list = acct_storage_g_get_qos(
 					db_conn, NULL);
 			}
-			if(end > 2 && argv[i][end-1] == '='
-			   && (argv[i][end-2] == '+' 
-			       || argv[i][end-2] == '-'))
-				option = (int)argv[i][end-2];
 
 			addto_qos_char_list(add_qos_list, qos_list,
 					    argv[i]+end, option);
-- 
GitLab