X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbeaglelogic%2Fbeaglelogic_native.c;h=af5e650f30dbdb89ef034a6d5f96d31e0ae6616c;hb=5dfa77b54a45b7a767b03c4dce41ea41e62816eb;hp=f94ffcc035ba508ab1d2a630e9b68ab5f94741e5;hpb=f82525e60d50c7bd06e2d398c3244a6b3aecc46a;p=libsigrok.git diff --git a/src/hardware/beaglelogic/beaglelogic_native.c b/src/hardware/beaglelogic/beaglelogic_native.c index f94ffcc0..af5e650f 100644 --- a/src/hardware/beaglelogic/beaglelogic_native.c +++ b/src/hardware/beaglelogic/beaglelogic_native.c @@ -1,7 +1,7 @@ /* * This file is part of the libsigrok project. * - * Copyright (C) 2014-17 Kumar Abhishek + * Copyright (C) 2014-2017 Kumar Abhishek * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,10 +88,12 @@ static int beaglelogic_get_lasterror(struct dev_context *devc) if ((fd = open(BEAGLELOGIC_SYSFS_ATTR(lasterror), O_RDONLY)) == -1) return SR_ERR; - if ((ret = read(fd, buf, 16)) < 0) + ret = read(fd, buf, 16); + close(fd); + + if (ret) return SR_ERR; - close(fd); devc->last_error = strtoul(buf, NULL, 10); return SR_OK;