From: pr.jung Date: Tue, 8 May 2018 07:32:18 +0000 (+0900) Subject: block: When block device is not found, GetDeviceInfo return with id less than 0 X-Git-Tag: submit/tizen/20180508.075947^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ca5de7aeeeca9824910ef834a7d15313c07849f;p=platform%2Fcore%2Fsystem%2Fstoraged.git block: When block device is not found, GetDeviceInfo return with id less than 0 Change-Id: Ic434c6dc0e52625d772e8a9a8c172a8d01dcf182 Signed-off-by: pr.jung --- diff --git a/src/block/block.c b/src/block/block.c index d87016d..ec4295f 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -3218,6 +3218,7 @@ static GVariant *request_get_device_info(GDBusConnection *conn, { struct block_device *bdev = NULL; struct block_data *data = NULL; + struct block_data nodata = {0,}; int id; g_variant_get(param, "(i)", &id); @@ -3230,6 +3231,11 @@ static GVariant *request_get_device_info(GDBusConnection *conn, goto out; out: + if (!data) { + nodata.id = -ENODEV; + data = &nodata; + } + return block_data_to_gvariant(data, -1); }