Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen check for write and close errors, from wiz
details: https://anonhg.NetBSD.org/src/rev/5be9e4fcb6c6
branches: trunk
changeset: 537201:5be9e4fcb6c6
user: christos <christos%NetBSD.org@localhost>
date: Sat Sep 28 01:34:36 2002 +0000
description:
check for write and close errors, from wiz
diffstat:
lib/libc/gen/utmpx.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (35 lines):
diff -r e5a92289e134 -r 5be9e4fcb6c6 lib/libc/gen/utmpx.c
--- a/lib/libc/gen/utmpx.c Sat Sep 28 01:25:01 2002 +0000
+++ b/lib/libc/gen/utmpx.c Sat Sep 28 01:34:36 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utmpx.c,v 1.11 2002/09/26 17:08:42 wiz Exp $ */
+/* $NetBSD: utmpx.c,v 1.12 2002/09/28 01:34:36 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: utmpx.c,v 1.11 2002/09/26 17:08:42 wiz Exp $");
+__RCSID("$NetBSD: utmpx.c,v 1.12 2002/09/28 01:34:36 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -297,10 +297,13 @@
(void)memset(&ut, 0, sizeof(ut));
ut.ut_type = SIGNATURE;
(void)memcpy(ut.ut_user, vers, sizeof(vers));
- (void)write(fd, &ut, sizeof(ut));
+ if ((write(fd, &ut, sizeof(ut)) == -1)
+ return -1;
}
- (void)write(fd, utx, sizeof(*utx));
- (void)close(fd);
+ if (write(fd, utx, sizeof(*utx)) == -1)
+ return -1;
+ if (close(fd) == -1)
+ return -1;
return 0;
}
Home |
Main Index |
Thread Index |
Old Index