From d8d490bd8049ccad9e5a8bede183ce63bbb7e78d Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Thu, 26 Mar 2020 07:29:34 +0900 Subject: [PATCH] Fixed incorrect use of errno in usb cfs client Change-Id: Ib091544138444c4108c7b09eb3e70e830661648e --- hw/usb_cfs_client_common.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/usb_cfs_client_common.c b/hw/usb_cfs_client_common.c index 0a1990b..f03395c 100644 --- a/hw/usb_cfs_client_common.c +++ b/hw/usb_cfs_client_common.c @@ -187,13 +187,10 @@ static int cfs_set_gadget_strs(struct cfs_client *cfs_client, static int cfs_ensure_dir(char *path) { - int ret; - - ret = mkdir(path, 0770); - if (ret < 0) - ret = errno == EEXIST ? 0 : errno; + if (mkdir(path, 0770) < 0) + return (errno == EEXIST) ? 0 : -errno; - return ret; + return 0; } -- 2.7.4