diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-09 13:40:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-09 13:40:56 +0000 |
commit | e1f027dbecc746ab9134cf7a4a33625194295077 (patch) | |
tree | d85971356e032eb4e6dd135aa011ced71ae9b085 /sbin | |
parent | 4f9ac9a1e88e9af938136c36d0121b04df70f4a5 (diff) |
better error messages
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mount_msdos/mount_msdos.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c index 44d3ca3f92e..fb13e8f90a8 100644 --- a/sbin/mount_msdos/mount_msdos.c +++ b/sbin/mount_msdos/mount_msdos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_msdos.c,v 1.6 1996/11/24 23:46:46 millert Exp $ */ +/* $OpenBSD: mount_msdos.c,v 1.7 1996/12/09 13:40:55 deraadt Exp $ */ /* $NetBSD: mount_msdos.c,v 1.16 1996/10/24 00:12:50 cgd Exp $ */ /* @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: mount_msdos.c,v 1.6 1996/11/24 23:46:46 millert Exp $"; +static char rcsid[] = "$OpenBSD: mount_msdos.c,v 1.7 1996/12/09 13:40:55 deraadt Exp $"; #endif /* not lint */ #include <sys/cdefs.h> @@ -47,6 +47,7 @@ static char rcsid[] = "$OpenBSD: mount_msdos.c,v 1.6 1996/11/24 23:46:46 millert #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <errno.h> #include "mntopts.h" @@ -70,6 +71,7 @@ main(argc, argv) struct stat sb; int c, mntflags, set_gid, set_uid, set_mask; char *dev, *dir, ndir[MAXPATHLEN+1]; + char *errcause; mntflags = set_gid = set_uid = set_mask = 0; (void)memset(&args, '\0', sizeof(args)); @@ -143,8 +145,24 @@ main(argc, argv) args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); } - if (mount(MOUNT_MSDOS, dir, mntflags, &args) < 0) - err(1, "mount"); + if (mount(MOUNT_MSDOS, dir, mntflags, &args) < 0) { + 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, dir, errcause); + } exit (0); } |