Don't report a syntax error if a preference name without a "." is

specified, report it as "no such preference" instead.  That should be
less confusing; see

   http://stackoverflow.com/questions/17757659/how-to-apply-and-override-preferences-with-tshark

for an example of confusion.

#BACKPORT 1.10, 1.8

svn path=/trunk/; revision=50745
This commit is contained in:
Guy Harris 2013-07-21 00:56:42 +00:00
parent 6635f5ef67
commit 21609c54bb
1 changed files with 3 additions and 13 deletions

View File

@ -3562,7 +3562,6 @@ set_pref(gchar *pref_name, const gchar *value, void *private_data _U_,
gchar *filter_expr = NULL;
module_t *module;
pref_t *pref;
gboolean had_a_dot;
if (strcmp(pref_name, PRS_GUI_FILTER_LABEL) == 0) {
filter_label = g_strdup(value);
@ -3624,21 +3623,12 @@ set_pref(gchar *pref_name, const gchar *value, void *private_data _U_,
/* To which module does this preference belong? */
module = NULL;
last_dotp = pref_name;
had_a_dot = FALSE;
while (!module) {
dotp = strchr(last_dotp, '.');
if (dotp == NULL) {
if (had_a_dot) {
/* no such module */
return PREFS_SET_NO_SUCH_PREF;
}
else {
/* no ".", so no module/name separator */
return PREFS_SET_SYNTAX_ERR;
}
}
else {
had_a_dot = TRUE;
/* Either there's no such module, or no module was specified.
In either case, that means there's no such preference. */
return PREFS_SET_NO_SUCH_PREF;
}
*dotp = '\0'; /* separate module and preference name */
module = prefs_find_module(pref_name);