Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libutil Fix compat code, so if we failed to make raw, re...
details: https://anonhg.NetBSD.org/src/rev/dfad40e3a659
branches: trunk
changeset: 778698:dfad40e3a659
user: christos <christos%NetBSD.org@localhost>
date: Sun Apr 08 20:56:12 2012 +0000
description:
Fix compat code, so if we failed to make raw, return the regular path.
diffstat:
lib/libutil/getfsspecname.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diffs (45 lines):
diff -r b7b95dda3a01 -r dfad40e3a659 lib/libutil/getfsspecname.c
--- a/lib/libutil/getfsspecname.c Sun Apr 08 20:49:29 2012 +0000
+++ b/lib/libutil/getfsspecname.c Sun Apr 08 20:56:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getfsspecname.c,v 1.2 2012/04/07 17:10:02 christos Exp $ */
+/* $NetBSD: getfsspecname.c,v 1.3 2012/04/08 20:56:12 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: getfsspecname.c,v 1.2 2012/04/07 17:10:02 christos Exp $");
+__RCSID("$NetBSD: getfsspecname.c,v 1.3 2012/04/08 20:56:12 christos Exp $");
#include <sys/types.h>
#include <sys/sysctl.h>
@@ -67,18 +67,15 @@
*/
char rbuf[MAXPATHLEN];
if (name[0] == '/') {
- if (getdiskrawname(rbuf, sizeof(rbuf), name) == NULL) {
- savee = errno;
- strlcpy(buf, "makeraw failed", bufsiz);
- goto out;
+ if (getdiskrawname(rbuf, sizeof(rbuf), name) != NULL) {
+ if ((fd = open(rbuf, O_RDONLY)) == -1) {
+ if (errno == EBUSY) {
+ name = strrchr(name, '/') + 1;
+ goto search;
+ }
+ } else
+ close(fd);
}
- if ((fd = open(rbuf, O_RDONLY)) == -1) {
- if (errno == EBUSY) {
- name = strrchr(name, '/') + 1;
- goto search;
- }
- } else
- close(fd);
}
#endif
strlcpy(buf, name, bufsiz);
Home |
Main Index |
Thread Index |
Old Index