From 4f9ac9a1e88e9af938136c36d0121b04df70f4a5 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 9 Dec 1996 13:38:48 +0000 Subject: better error messages --- sbin/mount_lfs/mount_lfs.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'sbin/mount_lfs') diff --git a/sbin/mount_lfs/mount_lfs.c b/sbin/mount_lfs/mount_lfs.c index 47dee48316d..fcec7fa7902 100644 --- a/sbin/mount_lfs/mount_lfs.c +++ b/sbin/mount_lfs/mount_lfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_lfs.c,v 1.3 1996/06/23 14:31:24 deraadt Exp $ */ +/* $OpenBSD: mount_lfs.c,v 1.4 1996/12/09 13:38:47 deraadt Exp $ */ /* $NetBSD: mount_lfs.c,v 1.4 1996/04/13 05:35:44 cgd Exp $ */ /*- @@ -44,12 +44,14 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mount_lfs.c 8.3 (Berkeley) 3/27/94"; #else -static char rcsid[] = "$OpenBSD: mount_lfs.c,v 1.3 1996/06/23 14:31:24 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mount_lfs.c,v 1.4 1996/12/09 13:38:47 deraadt Exp $"; #endif #endif /* not lint */ +#include #include #include +#include #include #include @@ -79,6 +81,7 @@ main(argc, argv) struct ufs_args args; int ch, mntflags, noclean; char *fs_name, *options; + char *errcause; options = NULL; mntflags = noclean = 0; @@ -116,8 +119,24 @@ main(argc, argv) else args.export.ex_flags = 0; - if (mount(MOUNT_LFS, fs_name, mntflags, &args)) - err(1, NULL); + if (mount(MOUNT_LFS, fs_name, mntflags, &args) == -1) { + switch (errno) { + case EMFILE: + errcause = "mount table full"; + break; + case EINVAL: + if (mntflags & MNT_UPDATE) + errcause = + "specified device does not match mounted device"; + else + errcause = "incorrect super block"; + break; + default: + errcause = strerror(errno); + break; + } + errx(1, "%s on %s: %s", args.fspec, fs_name, errcause); + } if (!noclean) invoke_cleaner(fs_name); -- cgit v1.2.3