From 888ddc5021aa8032ac0472a696a20a632c717910 Mon Sep 17 00:00:00 2001 From: Guo Wenxue <guowenxue@gmail.com> Date: Thu, 25 Oct 2018 15:05:45 +0800 Subject: [PATCH] Update ds18b20.c, add close(fd) --- apue/1.File_IO/ds18b20.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/apue/1.File_IO/ds18b20.c b/apue/1.File_IO/ds18b20.c index d170de1..efb0025 100644 --- a/apue/1.File_IO/ds18b20.c +++ b/apue/1.File_IO/ds18b20.c @@ -76,6 +76,7 @@ /* find and get the chipset SN filename */ strcpy(chip,direntp->d_name); found = 1; + break; } } closedir(dirp); @@ -115,5 +116,7 @@ /* convert string value to float value */ *temp = atof(ptr)/1000; + close(fd); + return 0; } -- Gitblit v1.9.1