summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fs.d/deffs.c45
-rw-r--r--usr/src/cmd/fs.d/mount.c14
2 files changed, 30 insertions, 29 deletions
diff --git a/usr/src/cmd/fs.d/deffs.c b/usr/src/cmd/fs.d/deffs.c
index ace3f9beb5..402106eae9 100644
--- a/usr/src/cmd/fs.d/deffs.c
+++ b/usr/src/cmd/fs.d/deffs.c
@@ -19,14 +19,17 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990, 1991, 1997 SMI */
/* All Rights Reserved */
-#ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <deflt.h>
-#include <string.h>
+#include <stdio.h>
+#include <deflt.h>
+#include <string.h>
#define LOCAL "/etc/default/fs"
#define REMOTE "/etc/dfs/fstypes"
@@ -43,34 +46,24 @@
char *
default_fstype(char *special)
{
- char *deffs;
+ char *deffs = NULL;
static char buf[BUFSIZ];
FILE *fp;
if (*special == '/') {
- if (defopen(LOCAL) != 0)
- return ("ufs");
- else {
- if ((deffs = defread("LOCAL=")) == NULL) {
- defopen(NULL); /* close default file */
- return ("ufs");
- } else {
- defopen(NULL); /* close default file */
- return (deffs);
- }
+ if (defopen(LOCAL) == 0) {
+ deffs = defread("LOCAL=");
+ defopen(NULL); /* close default file */
}
} else {
- if ((fp = fopen(REMOTE, "r")) == NULL)
- return ("nfs");
- else {
- if (fgets(buf, sizeof (buf), fp) == NULL) {
- fclose(fp);
- return ("nfs");
- } else {
+ if ((fp = fopen(REMOTE, "r")) != NULL) {
+ if (fgets(buf, sizeof (buf), fp) != NULL)
deffs = strtok(buf, " \t\n");
- fclose(fp);
- return (deffs);
- }
+ fclose(fp);
}
+ if (deffs == NULL)
+ deffs = "nfs";
}
+
+ return (deffs != NULL ? deffs : "ufs");
}
diff --git a/usr/src/cmd/fs.d/mount.c b/usr/src/cmd/fs.d/mount.c
index 04a867b235..947767f5db 100644
--- a/usr/src/cmd/fs.d/mount.c
+++ b/usr/src/cmd/fs.d/mount.c
@@ -18,6 +18,11 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -26,9 +31,6 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-/*
- * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
- */
#include <stdio.h>
#include <stdio_ext.h>
@@ -1572,6 +1574,12 @@ check_fields(char *fstype, char *mountp)
{
struct stat64 stbuf;
+ if (fstype == NULL) {
+ fprintf(stderr,
+ gettext("%s: FSType cannot be determined\n"),
+ myname);
+ return (1);
+ }
if (strlen(fstype) > (size_t)FSTYPE_MAX) {
fprintf(stderr,
gettext("%s: FSType %s exceeds %d characters\n"),