GC unused variables. Prefer NULL over 0 for pointers.
This commit is contained in:
parent
e9401a9e0e
commit
7039dfb32f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=247856
@ -83,7 +83,7 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
int iovlen;
|
int iovlen;
|
||||||
int ch, mntflags, opts;
|
int ch, mntflags;
|
||||||
char *dev, *dir, *p, *val, mntpath[MAXPATHLEN];
|
char *dev, *dir, *p, *val, mntpath[MAXPATHLEN];
|
||||||
int verbose;
|
int verbose;
|
||||||
int ssector; /* starting sector, 0 for 1st session */
|
int ssector; /* starting sector, 0 for 1st session */
|
||||||
@ -91,7 +91,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
iov = NULL;
|
iov = NULL;
|
||||||
iovlen = 0;
|
iovlen = 0;
|
||||||
mntflags = opts = verbose = 0;
|
mntflags = verbose = 0;
|
||||||
ssector = -1;
|
ssector = -1;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "begjo:rs:vC:")) != -1)
|
while ((ch = getopt(argc, argv, "begjo:rs:vC:")) != -1)
|
||||||
@ -109,7 +109,7 @@ main(int argc, char **argv)
|
|||||||
build_iovec(&iov, &iovlen, "nojoliet", NULL, (size_t)-1);
|
build_iovec(&iov, &iovlen, "nojoliet", NULL, (size_t)-1);
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
getmntopts(optarg, mopts, &mntflags, &opts);
|
getmntopts(optarg, mopts, &mntflags, NULL);
|
||||||
p = strchr(optarg, '=');
|
p = strchr(optarg, '=');
|
||||||
val = NULL;
|
val = NULL;
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
|
@ -69,7 +69,7 @@ main(int argc, char **argv)
|
|||||||
struct iovec *iov = NULL;
|
struct iovec *iov = NULL;
|
||||||
int iovlen = 0;
|
int iovlen = 0;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int c, mntflags, set_gid, set_uid, set_mask, set_dirmask;
|
int c, set_gid, set_uid, set_mask, set_dirmask;
|
||||||
char *dev, *dir, mntpath[MAXPATHLEN], *csp;
|
char *dev, *dir, mntpath[MAXPATHLEN], *csp;
|
||||||
char fstype[] = "msdosfs";
|
char fstype[] = "msdosfs";
|
||||||
char errmsg[255] = {0};
|
char errmsg[255] = {0};
|
||||||
@ -78,9 +78,8 @@ main(int argc, char **argv)
|
|||||||
mode_t mask = 0, dirmask = 0;
|
mode_t mask = 0, dirmask = 0;
|
||||||
uid_t uid = 0;
|
uid_t uid = 0;
|
||||||
gid_t gid = 0;
|
gid_t gid = 0;
|
||||||
getmnt_silent = 1;
|
|
||||||
|
|
||||||
mntflags = set_gid = set_uid = set_mask = set_dirmask = 0;
|
set_gid = set_uid = set_mask = set_dirmask = 0;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:D:W:")) != -1) {
|
while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:D:W:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -219,7 +218,7 @@ main(int argc, char **argv)
|
|||||||
build_iovec_argf(&iov, &iovlen, "mask", "%u", mask);
|
build_iovec_argf(&iov, &iovlen, "mask", "%u", mask);
|
||||||
build_iovec_argf(&iov, &iovlen, "dirmask", "%u", dirmask);
|
build_iovec_argf(&iov, &iovlen, "dirmask", "%u", dirmask);
|
||||||
|
|
||||||
if (nmount(iov, iovlen, mntflags) < 0) {
|
if (nmount(iov, iovlen, 0) < 0) {
|
||||||
if (errmsg[0])
|
if (errmsg[0])
|
||||||
err(1, "%s: %s", dev, errmsg);
|
err(1, "%s: %s", dev, errmsg);
|
||||||
else
|
else
|
||||||
|
@ -130,7 +130,7 @@ enum tryret {
|
|||||||
TRYRET_LOCALERR /* Local failure. */
|
TRYRET_LOCALERR /* Local failure. */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int fallback_mount(struct iovec *iov, int iovlen, int mntflags);
|
static int fallback_mount(struct iovec *iov, int iovlen);
|
||||||
static int sec_name_to_num(char *sec);
|
static int sec_name_to_num(char *sec);
|
||||||
static char *sec_num_to_name(int num);
|
static char *sec_num_to_name(int num);
|
||||||
static int getnfsargs(char *, struct iovec **iov, int *iovlen);
|
static int getnfsargs(char *, struct iovec **iov, int *iovlen);
|
||||||
@ -149,13 +149,12 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
int mntflags, num, iovlen;
|
int num, iovlen;
|
||||||
int osversion;
|
int osversion;
|
||||||
char *name, *p, *spec, *fstype;
|
char *name, *p, *spec, *fstype;
|
||||||
char mntpath[MAXPATHLEN], errmsg[255];
|
char mntpath[MAXPATHLEN], errmsg[255];
|
||||||
char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50];
|
char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50];
|
||||||
|
|
||||||
mntflags = 0;
|
|
||||||
iov = NULL;
|
iov = NULL;
|
||||||
iovlen = 0;
|
iovlen = 0;
|
||||||
memset(errmsg, 0, sizeof(errmsg));
|
memset(errmsg, 0, sizeof(errmsg));
|
||||||
@ -427,10 +426,10 @@ main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
osversion = getosreldate();
|
osversion = getosreldate();
|
||||||
if (osversion >= 702100) {
|
if (osversion >= 702100) {
|
||||||
if (nmount(iov, iovlen, mntflags))
|
if (nmount(iov, iovlen, 0))
|
||||||
err(1, "%s, %s", mntpath, errmsg);
|
err(1, "%s, %s", mntpath, errmsg);
|
||||||
} else {
|
} else {
|
||||||
if (fallback_mount(iov, iovlen, mntflags))
|
if (fallback_mount(iov, iovlen))
|
||||||
err(1, "%s, %s", mntpath, errmsg);
|
err(1, "%s, %s", mntpath, errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +472,7 @@ copyopt(struct iovec **newiov, int *newiovlen,
|
|||||||
* parameters. It should be eventually be removed.
|
* parameters. It should be eventually be removed.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
fallback_mount(struct iovec *iov, int iovlen, int mntflags)
|
fallback_mount(struct iovec *iov, int iovlen)
|
||||||
{
|
{
|
||||||
struct nfs_args args = {
|
struct nfs_args args = {
|
||||||
.version = NFS_ARGSVERSION,
|
.version = NFS_ARGSVERSION,
|
||||||
@ -663,7 +662,7 @@ fallback_mount(struct iovec *iov, int iovlen, int mntflags)
|
|||||||
copyopt(&newiov, &newiovlen, iov, iovlen, "fspath");
|
copyopt(&newiov, &newiovlen, iov, iovlen, "fspath");
|
||||||
copyopt(&newiov, &newiovlen, iov, iovlen, "errmsg");
|
copyopt(&newiov, &newiovlen, iov, iovlen, "errmsg");
|
||||||
|
|
||||||
return nmount(newiov, newiovlen, mntflags);
|
return nmount(newiov, newiovlen, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -68,12 +68,11 @@ main(int argc, char *argv[])
|
|||||||
char source[MAXPATHLEN];
|
char source[MAXPATHLEN];
|
||||||
char target[MAXPATHLEN];
|
char target[MAXPATHLEN];
|
||||||
char errmsg[255];
|
char errmsg[255];
|
||||||
int ch, mntflags, iovlen;
|
int ch, iovlen;
|
||||||
char nullfs[] = "nullfs";
|
char nullfs[] = "nullfs";
|
||||||
|
|
||||||
iov = NULL;
|
iov = NULL;
|
||||||
iovlen = 0;
|
iovlen = 0;
|
||||||
mntflags = 0;
|
|
||||||
errmsg[0] = '\0';
|
errmsg[0] = '\0';
|
||||||
while ((ch = getopt(argc, argv, "o:")) != -1)
|
while ((ch = getopt(argc, argv, "o:")) != -1)
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
@ -111,7 +110,7 @@ main(int argc, char *argv[])
|
|||||||
build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
|
build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
|
||||||
build_iovec(&iov, &iovlen, "target", target, (size_t)-1);
|
build_iovec(&iov, &iovlen, "target", target, (size_t)-1);
|
||||||
build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
|
build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
|
||||||
if (nmount(iov, iovlen, mntflags) < 0) {
|
if (nmount(iov, iovlen, 0) < 0) {
|
||||||
if (errmsg[0] != 0)
|
if (errmsg[0] != 0)
|
||||||
err(1, "%s: %s", source, errmsg);
|
err(1, "%s: %s", source, errmsg);
|
||||||
else
|
else
|
||||||
|
@ -58,7 +58,7 @@ main(int argc, char *argv[])
|
|||||||
while ((ch = getopt(argc, argv, "o:")) != -1) {
|
while ((ch = getopt(argc, argv, "o:")) != -1) {
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case 'o':
|
case 'o':
|
||||||
getmntopts(optarg, mopts, &mntflags, 0);
|
getmntopts(optarg, mopts, &mntflags, NULL);
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
|
@ -99,7 +99,7 @@ main(int argc, char *argv[])
|
|||||||
while ((ch = getopt(argc, argv, "o:")) != -1)
|
while ((ch = getopt(argc, argv, "o:")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'o':
|
case 'o':
|
||||||
getmntopts(optarg, mopts, &mntflags, 0);
|
getmntopts(optarg, mopts, &mntflags, NULL);
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
|
@ -74,17 +74,17 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct iovec iov[12];
|
struct iovec iov[12];
|
||||||
int ch, i, mntflags, opts, udf_flags;
|
int ch, i, mntflags, udf_flags;
|
||||||
char *dev, *dir, mntpath[MAXPATHLEN];
|
char *dev, *dir, mntpath[MAXPATHLEN];
|
||||||
char *cs_disk, *cs_local;
|
char *cs_disk, *cs_local;
|
||||||
int verbose;
|
int verbose;
|
||||||
|
|
||||||
i = mntflags = opts = udf_flags = verbose = 0;
|
i = mntflags = udf_flags = verbose = 0;
|
||||||
cs_disk = cs_local = NULL;
|
cs_disk = cs_local = NULL;
|
||||||
while ((ch = getopt(argc, argv, "o:vC:")) != -1)
|
while ((ch = getopt(argc, argv, "o:vC:")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'o':
|
case 'o':
|
||||||
getmntopts(optarg, mopts, &mntflags, &opts);
|
getmntopts(optarg, mopts, &mntflags, NULL);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose++;
|
verbose++;
|
||||||
|
@ -129,7 +129,7 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
int ch, mntflags, iovlen;
|
int ch, iovlen;
|
||||||
char source [MAXPATHLEN], target[MAXPATHLEN], errmsg[255];
|
char source [MAXPATHLEN], target[MAXPATHLEN], errmsg[255];
|
||||||
char uid_str[20], gid_str[20];
|
char uid_str[20], gid_str[20];
|
||||||
char fstype[] = "unionfs";
|
char fstype[] = "unionfs";
|
||||||
@ -137,7 +137,6 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
iov = NULL;
|
iov = NULL;
|
||||||
iovlen = 0;
|
iovlen = 0;
|
||||||
mntflags = 0;
|
|
||||||
memset(errmsg, 0, sizeof(errmsg));
|
memset(errmsg, 0, sizeof(errmsg));
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "bo:")) != -1) {
|
while ((ch = getopt(argc, argv, "bo:")) != -1) {
|
||||||
@ -190,7 +189,7 @@ main(int argc, char *argv[])
|
|||||||
build_iovec(&iov, &iovlen, "from", target, (size_t)-1);
|
build_iovec(&iov, &iovlen, "from", target, (size_t)-1);
|
||||||
build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
|
build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
|
||||||
|
|
||||||
if (nmount(iov, iovlen, mntflags))
|
if (nmount(iov, iovlen, 0))
|
||||||
err(EX_OSERR, "%s: %s", source, errmsg);
|
err(EX_OSERR, "%s: %s", source, errmsg);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user