From: Jo-Philipp Wich Date: Tue, 13 Dec 2016 15:26:03 +0000 (+0100) Subject: hotplug: fix uninitialized variable X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9cec4e6a94a6456bbb3deb14688c690217e4190c;p=project%2Fprocd.git hotplug: fix uninitialized variable Commit e999ab7 (hotplug: Check chown return value) introduced a new variable "ret" which is not explicitely initialized, leading to the following compile error: hotplug.c:155:18: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (!g || ret < 0) ^ cc1: all warnings being treated as errors Explicitely initialize it to zero to avoid that problem. Signed-off-by: Jo-Philipp Wich --- diff --git a/plug/hotplug.c b/plug/hotplug.c index 54a90cc..ae972f6 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -130,7 +130,7 @@ static void handle_makedev(struct blob_attr *msg, struct blob_attr *data) char *minor = hotplug_msg_find_var(msg, "MINOR"); char *major = hotplug_msg_find_var(msg, "MAJOR"); char *subsystem = hotplug_msg_find_var(msg, "SUBSYSTEM"); - int ret; + int ret = 0; blobmsg_parse_array(mkdev_policy, 3, tb, blobmsg_data(data), blobmsg_data_len(data)); if (tb[0] && tb[1] && minor && major && subsystem) {