summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mount_nwfs
diff options
context:
space:
mode:
authoruqs <uqs@FreeBSD.org>2010-03-04 16:07:14 +0000
committeruqs <uqs@FreeBSD.org>2010-03-04 16:07:14 +0000
commit929d20f7632cb403555b48db3b9ce91ac8496a89 (patch)
tree2d69bf925be8b0c8233b806e3a79671be155a84d /usr.sbin/mount_nwfs
parent8de589a2ac6846aec04faefdf7d60875d1eeb8cd (diff)
downloadFreeBSD-src-929d20f7632cb403555b48db3b9ce91ac8496a89.zip
FreeBSD-src-929d20f7632cb403555b48db3b9ce91ac8496a89.tar.gz
mount_nwfs(8): make WARNS=6 clean
uid_t and gid_t are unsigned. While initializing them to -1 and later checking against -1 to see if they are still at their default usually works, introduce two new flags and stop the inband signalling. Approved by: ed (co-mentor)
Diffstat (limited to 'usr.sbin/mount_nwfs')
-rw-r--r--usr.sbin/mount_nwfs/Makefile1
-rw-r--r--usr.sbin/mount_nwfs/mount_nwfs.c20
2 files changed, 13 insertions, 8 deletions
diff --git a/usr.sbin/mount_nwfs/Makefile b/usr.sbin/mount_nwfs/Makefile
index 8fbb9a8..8f46581 100644
--- a/usr.sbin/mount_nwfs/Makefile
+++ b/usr.sbin/mount_nwfs/Makefile
@@ -6,7 +6,6 @@ MAN= mount_nwfs.8
MOUNT= ${.CURDIR}/../../sbin/mount
CFLAGS+= -DNWFS -I${MOUNT}
-WARNS?= 0
.PATH: ${MOUNT}
diff --git a/usr.sbin/mount_nwfs/mount_nwfs.c b/usr.sbin/mount_nwfs/mount_nwfs.c
index 98a5f8e..5f5f19a 100644
--- a/usr.sbin/mount_nwfs/mount_nwfs.c
+++ b/usr.sbin/mount_nwfs/mount_nwfs.c
@@ -62,16 +62,19 @@ static int parsercfile(struct ncp_conn_loginfo *li, struct nwfs_args *mdata);
static struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_END
};
-static int
-parsercfile(struct ncp_conn_loginfo *li, struct nwfs_args *mdata) {
+static int
+parsercfile(struct ncp_conn_loginfo *li __unused,
+ struct nwfs_args *mdata __unused)
+{
return 0;
}
int
-main(int argc, char *argv[]) {
+main(int argc, char *argv[])
+{
NWCONN_HANDLE connHandle;
struct nwfs_args mdata;
struct ncp_conn_loginfo li;
@@ -80,6 +83,7 @@ main(int argc, char *argv[]) {
struct tm *tm;
time_t ltime;
int opt, error, mntflags, nlsopt, wall_clock;
+ int uid_set, gid_set;
size_t len;
char *p, *p1, tmp[1024];
u_char *pv;
@@ -100,7 +104,7 @@ main(int argc, char *argv[]) {
mntflags = error = 0;
bzero(&mdata,sizeof(mdata));
- mdata.uid = mdata.gid = -1;
+ gid_set = uid_set = 0;
nlsopt = 0;
if (ncp_li_init(&li, argc, argv)) return 1;
@@ -182,6 +186,7 @@ main(int argc, char *argv[]) {
if (pwd == NULL)
errx(EX_NOUSER, "unknown user '%s'", optarg);
mdata.uid = pwd->pw_uid;
+ uid_set = 1;
break;
}
case 'g': {
@@ -192,6 +197,7 @@ main(int argc, char *argv[]) {
if (grp == NULL)
errx(EX_NOUSER, "unknown group '%s'", optarg);
mdata.gid = grp->gr_gid;
+ gid_set = 1;
break;
}
case 'd':
@@ -282,10 +288,10 @@ main(int argc, char *argv[]) {
if (ncp_geteinfo(mount_point, &einfo) == 0)
errx(EX_OSERR, "can't mount on %s twice", mount_point);
- if (mdata.uid == -1) {
+ if (uid_set == 0) {
mdata.uid = st.st_uid;
}
- if (mdata.gid == -1) {
+ if (gid_set == 0) {
mdata.gid = st.st_gid;
}
if (mdata.file_mode == 0 ) {
OpenPOWER on IntegriCloud