1- /* $NetBSD: mount_lfs.c,v 1.7 1998/03/01 02:20:41 fvdl Exp $ */
1+ /* $NetBSD: mount_lfs.c,v 1.8 1999/06/25 19:28:36 perseant Exp $ */
22
33/*-
44 * Copyright (c) 1993, 1994
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993, 1994\n\
4343#if 0
4444static char sccsid [] = "@(#)mount_lfs.c 8.4 (Berkeley) 4/26/95" ;
4545#else
46- __RCSID ("$NetBSD: mount_lfs.c,v 1.7 1998/03/01 02:20:41 fvdl Exp $" );
46+ __RCSID ("$NetBSD: mount_lfs.c,v 1.8 1999/06/25 19:28:36 perseant Exp $" );
4747#endif
4848#endif /* not lint */
4949
@@ -53,6 +53,7 @@ __RCSID("$NetBSD: mount_lfs.c,v 1.7 1998/03/01 02:20:41 fvdl Exp $");
5353#include <ufs/ufs/ufsmount.h>
5454
5555#include <err.h>
56+ #include <errno.h>
5657#include <stdio.h>
5758#include <stdlib.h>
5859#include <string.h>
@@ -81,6 +82,7 @@ main(argc, argv)
8182 struct ufs_args args ;
8283 int ch , mntflags , noclean ;
8384 char * fs_name , * options ;
85+ const char * errcause ;
8486
8587 options = NULL ;
8688 mntflags = noclean = 0 ;
@@ -108,7 +110,7 @@ main(argc, argv)
108110 if (argc != 2 )
109111 usage ();
110112
111- args .fspec = argv [0 ]; /* the name of the device file */
113+ args .fspec = argv [0 ]; /* the name of the device file */
112114 fs_name = argv [1 ]; /* the mount point */
113115
114116#define DEFAULT_ROOTUID -2
@@ -118,8 +120,24 @@ main(argc, argv)
118120 else
119121 args .export .ex_flags = 0 ;
120122
121- if (mount (MOUNT_LFS , fs_name , mntflags , & args ))
122- err (1 , "%s" , "" );
123+ if (mount (MOUNT_LFS , fs_name , mntflags , & args )) {
124+ switch (errno ) {
125+ case EMFILE :
126+ errcause = "mount table full" ;
127+ break ;
128+ case EINVAL :
129+ if (mntflags & MNT_UPDATE )
130+ errcause =
131+ "specified device does not match mounted device" ;
132+ else
133+ errcause = "incorrect super block" ;
134+ break ;
135+ default :
136+ errcause = strerror (errno );
137+ break ;
138+ }
139+ errx (1 , "%s on %s: %s" , args .fspec , fs_name , errcause );
140+ }
123141
124142 if (!noclean )
125143 invoke_cleaner (fs_name );
0 commit comments