summaryrefslogtreecommitdiffstats
path: root/src/sbus/sbus_codegen
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2014-05-12 22:54:01 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-05-22 17:36:23 +0200
commit58229439447d5617913a5a2e173b78105c694842 (patch)
tree89dab51159dcd56df2b0b4cf0f7491e9b8b9751b /src/sbus/sbus_codegen
parent90e04eae7e54ec892a6f239783df94dab5d1ed9a (diff)
downloadsssd-58229439447d5617913a5a2e173b78105c694842.tar.gz
sssd-58229439447d5617913a5a2e173b78105c694842.tar.xz
sssd-58229439447d5617913a5a2e173b78105c694842.zip
SBUS: Return empty string if a string getter returns NULL
In line with getters never returning errors, a getter should return an empty string instead of NULL in case a string-like property in SSSD is not set. Reviewed-by: Stef Walter <stefw@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/sbus/sbus_codegen')
-rwxr-xr-xsrc/sbus/sbus_codegen5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sbus/sbus_codegen b/src/sbus/sbus_codegen
index a8f91b784..b671e939f 100755
--- a/src/sbus/sbus_codegen
+++ b/src/sbus/sbus_codegen
@@ -318,7 +318,10 @@ def source_getter_invoker(prop):
out(");")
out("")
- out(" out_val = prop_val;")
+ if prop.type == "s":
+ out(" out_val = prop_val == NULL ? \"\" : prop_val;")
+ else:
+ out(" out_val = prop_val;")
if prop.is_array:
out(" return sbus_request_return_array_as_variant(dbus_req, %s, (uint8_t*)out_val, prop_len, sizeof(%s));", prop.dbus_constant, prop.sssd_type)
else: