git » libjio » commit a243dff

samples: Close the files when using the classic API

author Alberto Bertogli
2011-02-26 21:46:33 UTC
committer Alberto Bertogli
2011-02-26 21:46:33 UTC
parent b02aff4eb7523b23ea8d11effb770754e5182bc3

samples: Close the files when using the classic API

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

samples/jio1.c +3 -0
samples/jio2.c +3 -0

diff --git a/samples/jio1.c b/samples/jio1.c
index d45901f..1713a46 100644
--- a/samples/jio1.c
+++ b/samples/jio1.c
@@ -41,6 +41,9 @@ static int classic(void)
 	if (rv != strlen(STR))
 		perror("write()");
 
+	if (close(fd))
+		perror("close()");
+
 	return 0;
 }
 
diff --git a/samples/jio2.c b/samples/jio2.c
index e720630..08521e3 100644
--- a/samples/jio2.c
+++ b/samples/jio2.c
@@ -43,6 +43,9 @@ static int classic(void)
 	if (rv != strlen(STR))
 		perror("write()");
 
+	if (close(fd))
+		perror("close()");
+
 	return 0;
 }