Skip to content

Commit 6a95c6e

Browse files
committed
* update for WARNS=1
* getopt returns -1 not EOF * fix .Nm usage
1 parent 11a89bb commit 6a95c6e

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

sbin/mount_umap/mount_umap.8

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $NetBSD: mount_umap.8,v 1.5 1997/05/29 01:48:38 cgd Exp $
1+
.\" $NetBSD: mount_umap.8,v 1.6 1997/09/15 06:10:23 lukem Exp $
22
.\"
33
.\" Copyright (c) 1992, 1993, 1994
44
.\" The Regents of the University of California. All rights reserved.
@@ -44,7 +44,7 @@
4444
.Nm mount_umap
4545
.Nd sample file system layer
4646
.Sh SYNOPSIS
47-
.Nm mount_umap
47+
.Nm
4848
.Op Fl o Ar options
4949
-u
5050
.Ar uid-mapfile
@@ -54,7 +54,7 @@
5454
.Ar mount-point
5555
.Sh DESCRIPTION
5656
The
57-
.Nm mount_umap
57+
.Nm
5858
command is used to mount a sub-tree of an existing file system
5959
that uses a different set of uids and gids than the local system.
6060
Such a file system could be mounted from a remote site via NFS or
@@ -73,13 +73,13 @@ man page for possible options and their meanings.
7373
.El
7474
.Pp
7575
The
76-
.Nm mount_umap
76+
.Nm
7777
command uses a set of files provided by the user to make correspondences
7878
between uids and gids in the sub-tree's original environment and
7979
some other set of ids in the local environment. For instance, user
8080
smith might have uid 1000 in the original environment, while having
8181
uid 2000 in the local environment. The
82-
.Nm mount_umap
82+
.Nm
8383
command allows the subtree from smith's original environment to be
8484
mapped in such a way that all files with owning uid 1000 look like
8585
they are actually owned by uid 2000.
@@ -115,13 +115,13 @@ at most 16 groups can be mapped by a given subtree.
115115
.Pp
116116
The mapfiles can be located anywhere in the file hierarchy, but they
117117
must be owned by root, and they must be writable only by root.
118-
.Nm mount_umap
118+
.Nm
119119
will refuse to map the sub-tree if the ownership or permissions on
120120
these files are improper. It will also balk if the count of mappings
121121
in the first line of the map files is not correct.
122122
.Pp
123123
The layer created by the
124-
.Nm mount_umap
124+
.Nm
125125
command is meant to serve as a simple example of file system layering.
126126
It is not meant for production use. The implementation is not very
127127
sophisticated.
@@ -130,5 +130,5 @@ sophisticated.
130130
.Xr mount_null 8
131131
.Sh HISTORY
132132
The
133-
.Nm mount_umap
133+
.Nm
134134
utility first appeared in 4.4BSD.

sbin/mount_umap/mount_umap.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: mount_umap.c,v 1.5 1996/04/13 01:32:05 jtc Exp $ */
1+
/* $NetBSD: mount_umap.c,v 1.6 1997/09/15 06:10:24 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1992, 1993, 1994
@@ -36,17 +36,17 @@
3636
* SUCH DAMAGE.
3737
*/
3838

39+
#include <sys/cdefs.h>
3940
#ifndef lint
40-
char copyright[] =
41-
"@(#) Copyright (c) 1992, 1993, 1994\n\
42-
The Regents of the University of California. All rights reserved.\n";
41+
__COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
42+
The Regents of the University of California. All rights reserved.\n");
4343
#endif /* not lint */
4444

4545
#ifndef lint
4646
#if 0
4747
static char sccsid[] = "@(#)mount_umap.c 8.3 (Berkeley) 3/27/94";
4848
#else
49-
static char rcsid[] = "$NetBSD: mount_umap.c,v 1.5 1996/04/13 01:32:05 jtc Exp $";
49+
__RCSID("$NetBSD: mount_umap.c,v 1.6 1997/09/15 06:10:24 lukem Exp $");
5050
#endif
5151
#endif /* not lint */
5252

@@ -87,6 +87,7 @@ const struct mntopt mopts[] = {
8787
{ NULL }
8888
};
8989

90+
int main __P((int, char *[]));
9091
void usage __P((void));
9192

9293
int
@@ -106,7 +107,7 @@ main(argc, argv)
106107

107108
mntflags = 0;
108109
mapfile = gmapfile = NULL;
109-
while ((ch = getopt(argc, argv, "g:o:u:")) != EOF)
110+
while ((ch = getopt(argc, argv, "g:o:u:")) != -1)
110111
switch (ch) {
111112
case 'g':
112113
gmapfile = optarg;
@@ -199,7 +200,7 @@ main(argc, argv)
199200
#endif /* MAPSECURITY */
200201

201202
if ((fscanf(gfp, "%d\n", &gnentries)) != 1)
202-
errx(1, "nentries not found%s", gmapfile, not);
203+
errx(1, "nentries not found%s", not);
203204
if (gnentries > MAPFILEENTRIES)
204205
errx(1,
205206
"maximum number of entries is %d%s", GMAPFILEENTRIES, not);
@@ -230,7 +231,7 @@ main(argc, argv)
230231
args.gmapdata = gmapdata;
231232

232233
if (mount(MOUNT_UMAP, argv[1], mntflags, &args))
233-
err(1, NULL);
234+
err(1, "%s", "");
234235
exit(0);
235236
}
236237

sbin/mount_union/mount_union.8

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $NetBSD: mount_union.8,v 1.6 1997/06/30 20:06:39 phil Exp $
1+
.\" $NetBSD: mount_union.8,v 1.7 1997/09/15 06:13:38 lukem Exp $
22
.\"
33
.\" Copyright (c) 1994
44
.\" The Regents of the University of California. All rights reserved.
@@ -43,14 +43,14 @@
4343
.Nm mount_union
4444
.Nd mount union filesystems
4545
.Sh SYNOPSIS
46-
.Nm mount_union
46+
.Nm
4747
.Op Fl br
4848
.Op Fl o Ar options
4949
.Ar directory
5050
.Ar uniondir
5151
.Sh DESCRIPTION
5252
The
53-
.Nm mount_union
53+
.Nm
5454
command
5555
attaches
5656
.Ar directory
@@ -204,6 +204,6 @@ over a union tree has the side-effect of creating
204204
a tree of shadow directories in the upper layer.
205205
.Sh HISTORY
206206
The
207-
.Nm mount_union
207+
.Nm
208208
command first appeared in
209209
.Bx 4.4 .

sbin/mount_union/mount_union.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: mount_union.c,v 1.3 1996/04/13 01:32:11 jtc Exp $ */
1+
/* $NetBSD: mount_union.c,v 1.4 1997/09/15 06:13:40 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1992, 1993, 1994
@@ -36,17 +36,17 @@
3636
* SUCH DAMAGE.
3737
*/
3838

39+
#include <sys/cdefs.h>
3940
#ifndef lint
40-
char copyright[] =
41-
"@(#) Copyright (c) 1992, 1993, 1994\n\
42-
The Regents of the University of California. All rights reserved.\n";
41+
__COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
42+
The Regents of the University of California. All rights reserved.\n");
4343
#endif /* not lint */
4444

4545
#ifndef lint
4646
#if 0
4747
static char sccsid[] = "@(#)mount_union.c 8.5 (Berkeley) 3/27/94";
4848
#else
49-
static char rcsid[] = "$NetBSD: mount_union.c,v 1.3 1996/04/13 01:32:11 jtc Exp $";
49+
__RCSID("$NetBSD: mount_union.c,v 1.4 1997/09/15 06:13:40 lukem Exp $");
5050
#endif
5151
#endif /* not lint */
5252

@@ -68,6 +68,7 @@ const struct mntopt mopts[] = {
6868
{ NULL }
6969
};
7070

71+
int main __P((int, char *[]));
7172
int subdir __P((const char *, const char *));
7273
void usage __P((void));
7374

@@ -82,7 +83,7 @@ main(argc, argv)
8283

8384
mntflags = 0;
8485
args.mntflags = UNMNT_ABOVE;
85-
while ((ch = getopt(argc, argv, "bo:r")) != EOF)
86+
while ((ch = getopt(argc, argv, "bo:r")) != -1)
8687
switch (ch) {
8788
case 'b':
8889
args.mntflags &= ~UNMNT_OPMASK;
@@ -116,7 +117,7 @@ main(argc, argv)
116117
args.target = target;
117118

118119
if (mount(MOUNT_UNION, argv[1], mntflags, &args))
119-
err(1, NULL);
120+
err(1, "%s", "");
120121
exit(0);
121122
}
122123

0 commit comments

Comments
 (0)