Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librumpuser Clean up error handling in rumpuser_init()
details: https://anonhg.NetBSD.org/src/rev/d631c8816e89
branches: trunk
changeset: 330936:d631c8816e89
user: justin <justin%NetBSD.org@localhost>
date: Fri Jul 25 14:00:31 2014 +0000
description:
Clean up error handling in rumpuser_init()
diffstat:
lib/librumpuser/rumpfiber.c | 10 ++++++----
lib/librumpuser/rumpuser.c | 12 +++++++-----
lib/librumpuser/rumpuser_random.c | 6 +++---
3 files changed, 16 insertions(+), 12 deletions(-)
diffs (99 lines):
diff -r 56420a11e1c7 -r d631c8816e89 lib/librumpuser/rumpfiber.c
--- a/lib/librumpuser/rumpfiber.c Fri Jul 25 13:52:26 2014 +0000
+++ b/lib/librumpuser/rumpfiber.c Fri Jul 25 14:00:31 2014 +0000
@@ -66,7 +66,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpfiber.c,v 1.2 2014/07/22 22:41:58 justin Exp $");
+__RCSID("$NetBSD: rumpfiber.c,v 1.3 2014/07/25 14:00:31 justin Exp $");
#endif /* !lint */
#include <sys/ioctl.h>
@@ -410,14 +410,16 @@
int
rumpuser_init(int version, const struct rumpuser_hyperup *hyp)
{
+ int rv;
if (version != RUMPUSER_VERSION) {
printk("rumpuser version mismatch\n");
- return 1;
+ abort();
}
- if (rumpuser__random_init() != 0) {
- return 1;
+ rv = rumpuser__random_init();
+ if (rv != 0) {
+ ET(rv);
}
rumpuser__hyp = *hyp;
diff -r 56420a11e1c7 -r d631c8816e89 lib/librumpuser/rumpuser.c
--- a/lib/librumpuser/rumpuser.c Fri Jul 25 13:52:26 2014 +0000
+++ b/lib/librumpuser/rumpuser.c Fri Jul 25 14:00:31 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser.c,v 1.62 2014/07/22 22:41:58 justin Exp $ */
+/* $NetBSD: rumpuser.c,v 1.63 2014/07/25 14:00:31 justin Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.62 2014/07/22 22:41:58 justin Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.63 2014/07/25 14:00:31 justin Exp $");
#endif /* !lint */
#include <sys/stat.h>
@@ -57,15 +57,17 @@
int
rumpuser_init(int version, const struct rumpuser_hyperup *hyp)
{
+ int rv;
if (version != RUMPUSER_VERSION) {
fprintf(stderr, "rumpuser mismatch, kern: %d, hypervisor %d\n",
version, RUMPUSER_VERSION);
- return 1;
+ abort();
}
- if (rumpuser__random_init() != 0) {
- return 1;
+ rv = rumpuser__random_init();
+ if (rv != 0) {
+ ET(rv);
}
rumpuser__thrinit();
diff -r 56420a11e1c7 -r d631c8816e89 lib/librumpuser/rumpuser_random.c
--- a/lib/librumpuser/rumpuser_random.c Fri Jul 25 13:52:26 2014 +0000
+++ b/lib/librumpuser/rumpuser_random.c Fri Jul 25 14:00:31 2014 +0000
@@ -26,7 +26,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_random.c,v 1.1 2014/07/22 22:41:58 justin Exp $");
+__RCSID("$NetBSD: rumpuser_random.c,v 1.2 2014/07/25 14:00:31 justin Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -64,7 +64,7 @@
random_fd = open(random_device, O_RDONLY);
if (random_fd < 0) {
fprintf(stderr, "random init open failed\n");
- return 1;
+ return errno;
}
return 0;
}
@@ -87,5 +87,5 @@
*retp = buflen;
#endif
- ET(0);
+ return 0;
}
Home |
Main Index |
Thread Index |
Old Index