Quellcode durchsuchen

If entry has ACTION for help then don't add help constructed from internal data

Serj Kalichev vor 1 Jahr
Ursprung
Commit
042ba82023
2 geänderte Dateien mit 3 neuen und 10 gelöschten Zeilen
  1. 1 2
      klish/ksession/ksession_parse.c
  2. 2 8
      klish/ktp/ktpd_session.c

+ 1 - 2
klish/ksession/ksession_parse.c

@@ -652,8 +652,7 @@ kexec_t *ksession_parse_for_local_exec(ksession_t *session,
 	kcontext_set_scheme(context, ksession_scheme(session));
 	kcontext_set_pargv(context, pargv);
 	kcontext_set_parent_pargv(context, parent_pargv);
-	// Service ACTIONs like PTYPE, CONDitions etc. doesn't need session
-	// data within context. Else it will be able to change path.
+	kcontext_set_session(context, session);
 	kexec_add_contexts(exec, context);
 
 	faux_argv_free(argv);

+ 2 - 8
klish/ktp/ktpd_session.c

@@ -725,8 +725,6 @@ static bool_t ktpd_session_process_help(ktpd_session_t *ktpd, faux_msg_t *msg)
 		while ((candidate = kpargv_completions_each(&citer))) {
 			const kentry_t *help = NULL;
 			const kentry_t *ptype = NULL;
-			bool_t help_added = BOOL_FALSE;
-
 
 			// Get PTYPE of parameter
 			ptype = kentry_nested_by_purpose(candidate,
@@ -764,18 +762,14 @@ static bool_t ktpd_session_process_help(ktpd_session_t *ktpd, faux_msg_t *msg)
 							break;
 						}
 						help_struct = help_new(prefix_str, line_str);
-						if (faux_list_add(help_list, help_struct))
-							help_added = BOOL_TRUE;
-						else
+						if (!faux_list_add(help_list, help_struct))
 							help_free(help_struct);
 					} while (line_str);
 					faux_str_free(out);
 				}
-			}
-
 
 			// Generate help with available information
-			if (!help_added) {
+			} else {
 				const char *prefix_str = NULL;
 				const char *line_str = NULL;