/*
* This file is part of the libsigrok project.
*
- * Copyright (C) 2014-17 Kumar Abhishek <abhishek@theembeddedkitchen.net>
+ * Copyright (C) 2014-2017 Kumar Abhishek <abhishek@theembeddedkitchen.net>
*
* 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
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;