[PATCH 07/32] tools:iio:lsiio: add closedir before exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In dump_channels() the DIR *dp was left open on exit. Close it and check
for errors.

Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
---
 tools/iio/lsiio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c
index c585440..65a2385 100644
--- a/tools/iio/lsiio.c
+++ b/tools/iio/lsiio.c
@@ -56,7 +56,7 @@ static int dump_channels(const char *dev_dir_name)
 			printf("   %-10s\n", ent->d_name);
 		}
 
-	return 0;
+	return (closedir(dp) == -1) ? -errno : 0;
 }
 
 static int dump_one_device(const char *dev_dir_name)
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux