-/* $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 $ */
/*-
#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>
struct ufs_args args;
int ch, mntflags, noclean;
char *fs_name, *options;
+ char *errcause;
options = NULL;
mntflags = noclean = 0;
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);
-/* $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 $ */
/*
*/
#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>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
#include "mntopts.h"
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));
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);
}