aboutsummaryrefslogtreecommitdiff
path: root/lib/libufs/type.c
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2009-06-11 18:04:57 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2009-06-11 18:04:57 +0000
commit990b6d05ab30a8dd6d5ba69490bd0d8d07a6f67d (patch)
tree8ecb5eb23603f1b6c1ced0476a36ae485af85109 /lib/libufs/type.c
parenta4cf065a39e2aa73162cd1111c275eda1e469ca0 (diff)
downloadsrc-990b6d05ab30a8dd6d5ba69490bd0d8d07a6f67d.tar.gz
src-990b6d05ab30a8dd6d5ba69490bd0d8d07a6f67d.zip
Allow libufs(3) functions to operate on a regular file. This makes it possible to
use almost anything that uses libufs(3) against a file as an unprivileged user, e.g. tunefs(8) and dumpfs(8) against a makefs(8)-created image. Prodded by: kensmith
Notes
Notes: svn path=/head/; revision=194030
Diffstat (limited to 'lib/libufs/type.c')
-rw-r--r--lib/libufs/type.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libufs/type.c b/lib/libufs/type.c
index 9b7470a33a84..8a553bedbc97 100644
--- a/lib/libufs/type.c
+++ b/lib/libufs/type.c
@@ -108,7 +108,10 @@ again: if ((ret = stat(name, &st)) < 0) {
*/
name = oname;
}
- if (ret >= 0 && S_ISCHR(st.st_mode)) {
+ if (ret >= 0 && S_ISREG(st.st_mode)) {
+ /* Possibly a disk image, give it a try. */
+ ;
+ } else if (ret >= 0 && S_ISCHR(st.st_mode)) {
/* This is what we need, do nothing. */
;
} else if ((fs = getfsfile(name)) != NULL) {