summaryrefslogtreecommitdiffstats
path: root/sbin/mount_portal
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1996-05-13 17:43:19 +0000
committerwollman <wollman@FreeBSD.org>1996-05-13 17:43:19 +0000
commit5eea098aaa4a43538ceabc7a7ffaeb0986cea33c (patch)
tree45a3a22a6378c4db6229097d19a3e57ef24f2e5c /sbin/mount_portal
parente1cb6ef79c8ab94af413aabdbf5b2b7c1ffca3a9 (diff)
downloadFreeBSD-src-5eea098aaa4a43538ceabc7a7ffaeb0986cea33c.zip
FreeBSD-src-5eea098aaa4a43538ceabc7a7ffaeb0986cea33c.tar.gz
Get rid of the last vestiges of the old MOUNT_* constants in the
mount_* programs. While we're at it, collapse the four now-identical mount programs for devfs, fdesc, kernfs, and procfs into links to a new mount_std(8) which can mount any really generic filesystem such as these when called with the appropriate argv[0]. Also, convert the mount programs to use sysexits.h.
Diffstat (limited to 'sbin/mount_portal')
-rw-r--r--sbin/mount_portal/mount_portal.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c
index 51184df..6035a1a 100644
--- a/sbin/mount_portal/mount_portal.c
+++ b/sbin/mount_portal/mount_portal.c
@@ -41,7 +41,11 @@ char copyright[] =
#endif /* not lint */
#ifndef lint
+/*
static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
+*/
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <sys/param.h>
@@ -58,6 +62,7 @@ static char sccsid[] = "@(#)mount_portal.c 8.4 (Berkeley) 3/27/94";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sysexits.h>
#include <unistd.h>
#include "mntopts.h"
@@ -69,7 +74,7 @@ struct mntopt mopts[] = {
{ NULL }
};
-static void usage __P((void));
+static __dead void usage __P((void)) __dead2;
static sig_atomic_t readcf; /* Set when SIGHUP received */
@@ -144,8 +149,7 @@ main(argc, argv)
*/
un.sun_family = AF_UNIX;
if (sizeof(_PATH_TMPPORTAL) >= sizeof(un.sun_path)) {
- fprintf(stderr, "mount_portal: portal socket name too long\n");
- exit(1);
+ errx(EX_SOFTWARE, "portal socket name too long");
}
strcpy(un.sun_path, _PATH_TMPPORTAL);
mktemp(un.sun_path);
@@ -153,8 +157,7 @@ main(argc, argv)
so = socket(AF_UNIX, SOCK_STREAM, 0);
if (so < 0) {
- fprintf(stderr, "mount_portal: socket: %s\n", strerror(errno));
- exit(1);
+ err(EX_OSERR, "socket");
}
(void) unlink(un.sun_path);
if (bind(so, (struct sockaddr *) &un, sizeof(un)) < 0)
@@ -171,10 +174,12 @@ main(argc, argv)
vfc = getvfsbyname("portal");
if(!vfc && vfsisloadable("portal")) {
if(vfsload("portal"))
- err(1, "vfsload(portal)");
+ err(EX_OSERR, "vfsload(portal)");
endvfsent(); /* flush cache */
vfc = getvfsbyname("portal");
}
+ if (!vfc)
+ errx(EX_OSERR, "portal filesystem is not available");
rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
if (rc < 0)
@@ -233,7 +238,7 @@ main(argc, argv)
if (errno == EINTR)
continue;
syslog(LOG_ERR, "select: %s", strerror(errno));
- exit(1);
+ exit(EX_OSERR);
}
if (rc == 0)
break;
@@ -247,7 +252,7 @@ main(argc, argv)
break;
if (errno != EINTR) {
syslog(LOG_ERR, "accept: %s", strerror(errno));
- exit(1);
+ exit(EX_OSERR);
}
continue;
}
@@ -282,5 +287,5 @@ usage()
{
(void)fprintf(stderr,
"usage: mount_portal [-o options] config mount-point\n");
- exit(1);
+ exit(EX_USAGE);
}
OpenPOWER on IntegriCloud