Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/examples/rump/sdread Check open return value and close...
details: https://anonhg.NetBSD.org/src/rev/b399c1475991
branches: trunk
changeset: 753384:b399c1475991
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Mar 25 15:00:20 2010 +0000
description:
Check open return value and close fd when we're done.
diffstat:
share/examples/rump/sdread/sdread.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (28 lines):
diff -r 90f153c48d8e -r b399c1475991 share/examples/rump/sdread/sdread.c
--- a/share/examples/rump/sdread/sdread.c Thu Mar 25 14:59:36 2010 +0000
+++ b/share/examples/rump/sdread/sdread.c Thu Mar 25 15:00:20 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdread.c,v 1.5 2010/03/22 20:37:26 pooka Exp $ */
+/* $NetBSD: sdread.c,v 1.6 2010/03/25 15:00:20 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -63,6 +63,9 @@
int fd, val = 0, rounds = 0;
fd = rump_sys_open("/dev/rcd0d", O_RDWR);
+ if (fd == -1)
+ return;
+
do {
if (rounds > 0) {
if (rounds == 1) {
@@ -82,6 +85,8 @@
printf(" giving up\n");
else
printf(" done!\n");
+
+ rump_sys_close(fd);
}
int
Home |
Main Index |
Thread Index |
Old Index