From: Yunmi Ha Date: Thu, 6 Feb 2020 07:55:03 +0000 (+0900) Subject: Fix svace issue X-Git-Tag: submit/tizen/20200207.103010^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F224105%2F1;p=platform%2Fcore%2Fsystem%2Fstoraged.git Fix svace issue - Remove unreachable code - Replace strtok to strtok_r - Add initialize code Change-Id: Ia17c0dbfc104b839b4debcb3140aa660563ad91d Signed-off-by: Yunmi Ha --- diff --git a/src/block/block.c b/src/block/block.c index 9f0463c..6fdc678 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -2858,12 +2858,6 @@ static GVariant *request_mount_block(GDBusConnection *conn, bdev->on_private_op = REQ_PRIVATE; bdev->private_pid = dbus_handle_get_sender_pid(NULL, sender); _D("Private operation state(%d). pid=%d.", bdev->on_private_op, bdev->private_pid); - } else { - if (bdev->on_private_op != REQ_NORMAL) { - _E("Failed to process mount operation."); - ret = -EPERM; - goto out; - } } /* if requester want to use a specific mount point */ @@ -3423,7 +3417,7 @@ static GVariant *request_get_mmc_primary(GDBusConnection *conn, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { struct block_device *bdev; - struct block_data *data, nodata = {0,}; + struct block_data *data = NULL, nodata = {0,}; dd_list *elem; bool found = false; int i; diff --git a/src/block/utils.c b/src/block/utils.c index 3588914..572cad3 100644 --- a/src/block/utils.c +++ b/src/block/utils.c @@ -146,6 +146,7 @@ bool is_in_use_partition(const char *partition) char *line = NULL; size_t len = 0; bool ret = false; + char *saveptr; if (asprintf(&cmd, "/usr/bin/fuser -m %s", partition) < 0) { _E("Failed to call asprintf: %m"); @@ -159,7 +160,7 @@ bool is_in_use_partition(const char *partition) return false; if (getline(&line, &len, fp) != -1) { - if (strtok(line, " ") != NULL) + if (strtok_r(line, " ", &saveptr) != NULL) ret = true; }