Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fsck Support symlinks to a block device to resolve the ...
details: https://anonhg.NetBSD.org/src/rev/a0c8a21a4292
branches: trunk
changeset: 783960:a0c8a21a4292
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Jan 13 19:53:16 2013 +0000
description:
Support symlinks to a block device to resolve the name of the
corresponding raw device.
diffstat:
sbin/fsck/fsutil.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (41 lines):
diff -r cd7547c9742c -r a0c8a21a4292 sbin/fsck/fsutil.c
--- a/sbin/fsck/fsutil.c Sun Jan 13 18:47:57 2013 +0000
+++ b/sbin/fsck/fsutil.c Sun Jan 13 19:53:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsutil.c,v 1.23 2012/04/08 04:19:14 christos Exp $ */
+/* $NetBSD: fsutil.c,v 1.24 2013/01/13 19:53:16 mlelstv Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fsutil.c,v 1.23 2012/04/08 04:19:14 christos Exp $");
+__RCSID("$NetBSD: fsutil.c,v 1.24 2013/01/13 19:53:16 mlelstv Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -173,6 +173,7 @@
const char *newname, *raw, *cooked;
struct fstab *fsp;
int retried = 0;
+ ssize_t len;
char cbuf[MAXPATHLEN];
static char buf[MAXPATHLEN];
@@ -181,7 +182,13 @@
perr("Can't stat `/'");
return (origname);
}
- newname = origname;
+ len = readlink(origname, cbuf, sizeof(cbuf)-1);
+ if (len == -1) {
+ newname = origname;
+ } else {
+ cbuf[len] = '\0';
+ newname = cbuf;
+ }
retry:
if (stat(newname, &stblock) < 0) {
perr("Can't stat `%s'", newname);
Home |
Main Index |
Thread Index |
Old Index