summaryrefslogtreecommitdiff
path: root/sbin/mount_lfs
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-09 13:38:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-09 13:38:48 +0000
commit4f9ac9a1e88e9af938136c36d0121b04df70f4a5 (patch)
tree0ac034134d42d9a3a53d338588a981265583e9a8 /sbin/mount_lfs
parent5124a623a4cb8b9e453217400bb0e608e1c12547 (diff)
better error messages
Diffstat (limited to 'sbin/mount_lfs')
-rw-r--r--sbin/mount_lfs/mount_lfs.c27
1 files changed, 23 insertions, 4 deletions
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 <sys/types.h>
#include <sys/param.h>
#include <sys/mount.h>
+#include <errno.h>
#include <err.h>
#include <stdio.h>
@@ -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);