From 021a991a36f5bd7c83b92672d285bf780fe9d2e3 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Thu, 9 Oct 2008 19:15:27 +0000 Subject: [PATCH] prefs should not create empty dictionary for KIM_OPTIONS_DEFAULT ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20855 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kim/lib/mac/kim_os_preferences.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/kim/lib/mac/kim_os_preferences.c b/src/kim/lib/mac/kim_os_preferences.c index 0b48a7fbb..87700ef89 100644 --- a/src/kim/lib/mac/kim_os_preferences.c +++ b/src/kim/lib/mac/kim_os_preferences.c @@ -226,7 +226,7 @@ static kim_error kim_os_preferences_set_value (kim_preference_key in_key, kim_error err = KIM_NO_ERROR; CFStringRef key = NULL; - if (!err && !in_value) { err = check_error (KIM_NULL_PARAMETER_ERR); } + /* in_value may be NULL if removing the key */ if (!err) { key = kim_os_preferences_cfstring_for_key (in_key); @@ -890,18 +890,19 @@ kim_error kim_os_preferences_set_options_for_key (kim_preference_key in_key, /* in_options may be KIM_OPTIONS_DEFAULT, in which case we empty the dict */ - if (!err) { + if (!err && in_options) { dictionary = CFDictionaryCreateMutable (kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); if (!dictionary) { err = check_error (KIM_OUT_OF_MEMORY_ERR); } - } - - if (!err && in_options) { - err = kim_os_preferences_options_to_dictionary (in_options, dictionary); + + if (!err) { + err = kim_os_preferences_options_to_dictionary (in_options, dictionary); + } } if (!err) { + /* NULL dictioray will remove any entry for this key */ err = kim_os_preferences_set_value (in_key, dictionary); } -- 2.26.2