From: Brendan Le Foll Date: Mon, 21 Dec 2015 15:16:08 +0000 (+0000) Subject: iioc.: remove call to stat before mkdir as superflous X-Git-Tag: v0.9.0~9 X-Git-Url: http://review.tizen.org/git/?p=contrib%2Fmraa.git;a=commitdiff_plain;h=725ce5e9469328df2ff4b70cd6534fcd71e7ba9f iioc.: remove call to stat before mkdir as superflous This is especailly true since we don't care about the outcome, or do we? We probably should check errno for EEXIST and offer an error if the error is something else Signed-off-by: Brendan Le Foll --- diff --git a/src/iio/iio.c b/src/iio/iio.c index cab10fd..ef2cb3e 100755 --- a/src/iio/iio.c +++ b/src/iio/iio.c @@ -545,17 +545,14 @@ mraa_iio_create_trigger(mraa_iio_context dev, const char* trigger) struct stat configfs_status; struct stat trigger_status; char buf[MAX_SIZE]; + int ret; if (stat(IIO_CONFIGFS_TRIGGER, &configfs_status) == 0) { memset(buf, 0, MAX_SIZE); snprintf(buf, MAX_SIZE, IIO_CONFIGFS_TRIGGER "%s", trigger); - if (stat(buf, &trigger_status) != 0) { - if (mkdir(buf, configfs_status.st_mode) == 0) - return MRAA_SUCCESS; - } else { - // trigger folder already created - return MRAA_SUCCESS; - } + // we actually don't care if this doesn't succeed, as it just means + // it's already been initialised + mkdir(buf, configfs_status.st_mode); } return MRAA_ERROR_UNSPECIFIED;