GC unused variables. Prefer NULL over 0 for pointers.

This commit is contained in:
Jung-uk Kim 2013-03-05 22:41:35 +00:00
parent e9401a9e0e
commit 7039dfb32f
8 changed files with 21 additions and 25 deletions

View File

@ -83,7 +83,7 @@ main(int argc, char **argv)
{
struct iovec *iov;
int iovlen;
int ch, mntflags, opts;
int ch, mntflags;
char *dev, *dir, *p, *val, mntpath[MAXPATHLEN];
int verbose;
int ssector; /* starting sector, 0 for 1st session */
@ -91,7 +91,7 @@ main(int argc, char **argv)
iov = NULL;
iovlen = 0;
mntflags = opts = verbose = 0;
mntflags = verbose = 0;
ssector = -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);
break;
case 'o':
getmntopts(optarg, mopts, &mntflags, &opts);
getmntopts(optarg, mopts, &mntflags, NULL);
p = strchr(optarg, '=');
val = NULL;
if (p != NULL) {

View File

@ -69,7 +69,7 @@ main(int argc, char **argv)
struct iovec *iov = NULL;
int iovlen = 0;
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 fstype[] = "msdosfs";
char errmsg[255] = {0};
@ -78,9 +78,8 @@ main(int argc, char **argv)
mode_t mask = 0, dirmask = 0;
uid_t uid = 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) {
switch (c) {
@ -219,7 +218,7 @@ main(int argc, char **argv)
build_iovec_argf(&iov, &iovlen, "mask", "%u", mask);
build_iovec_argf(&iov, &iovlen, "dirmask", "%u", dirmask);
if (nmount(iov, iovlen, mntflags) < 0) {
if (nmount(iov, iovlen, 0) < 0) {
if (errmsg[0])
err(1, "%s: %s", dev, errmsg);
else

View File

@ -130,7 +130,7 @@ enum tryret {
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 char *sec_num_to_name(int num);
static int getnfsargs(char *, struct iovec **iov, int *iovlen);
@ -149,13 +149,12 @@ main(int argc, char *argv[])
{
int c;
struct iovec *iov;
int mntflags, num, iovlen;
int num, iovlen;
int osversion;
char *name, *p, *spec, *fstype;
char mntpath[MAXPATHLEN], errmsg[255];
char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50];
mntflags = 0;
iov = NULL;
iovlen = 0;
memset(errmsg, 0, sizeof(errmsg));
@ -427,10 +426,10 @@ main(int argc, char *argv[])
*/
osversion = getosreldate();
if (osversion >= 702100) {
if (nmount(iov, iovlen, mntflags))
if (nmount(iov, iovlen, 0))
err(1, "%s, %s", mntpath, errmsg);
} else {
if (fallback_mount(iov, iovlen, mntflags))
if (fallback_mount(iov, iovlen))
err(1, "%s, %s", mntpath, errmsg);
}
@ -473,7 +472,7 @@ copyopt(struct iovec **newiov, int *newiovlen,
* parameters. It should be eventually be removed.
*/
static int
fallback_mount(struct iovec *iov, int iovlen, int mntflags)
fallback_mount(struct iovec *iov, int iovlen)
{
struct nfs_args args = {
.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, "errmsg");
return nmount(newiov, newiovlen, mntflags);
return nmount(newiov, newiovlen, 0);
}
static int

View File

@ -68,12 +68,11 @@ main(int argc, char *argv[])
char source[MAXPATHLEN];
char target[MAXPATHLEN];
char errmsg[255];
int ch, mntflags, iovlen;
int ch, iovlen;
char nullfs[] = "nullfs";
iov = NULL;
iovlen = 0;
mntflags = 0;
errmsg[0] = '\0';
while ((ch = getopt(argc, argv, "o:")) != -1)
switch(ch) {
@ -111,7 +110,7 @@ main(int argc, char *argv[])
build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
build_iovec(&iov, &iovlen, "target", target, (size_t)-1);
build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
if (nmount(iov, iovlen, mntflags) < 0) {
if (nmount(iov, iovlen, 0) < 0) {
if (errmsg[0] != 0)
err(1, "%s: %s", source, errmsg);
else

View File

@ -58,7 +58,7 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv, "o:")) != -1) {
switch(ch) {
case 'o':
getmntopts(optarg, mopts, &mntflags, 0);
getmntopts(optarg, mopts, &mntflags, NULL);
break;
case '?':
default:

View File

@ -99,7 +99,7 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv, "o:")) != -1)
switch (ch) {
case 'o':
getmntopts(optarg, mopts, &mntflags, 0);
getmntopts(optarg, mopts, &mntflags, NULL);
break;
case '?':
default:

View File

@ -74,17 +74,17 @@ int
main(int argc, char **argv)
{
struct iovec iov[12];
int ch, i, mntflags, opts, udf_flags;
int ch, i, mntflags, udf_flags;
char *dev, *dir, mntpath[MAXPATHLEN];
char *cs_disk, *cs_local;
int verbose;
i = mntflags = opts = udf_flags = verbose = 0;
i = mntflags = udf_flags = verbose = 0;
cs_disk = cs_local = NULL;
while ((ch = getopt(argc, argv, "o:vC:")) != -1)
switch (ch) {
case 'o':
getmntopts(optarg, mopts, &mntflags, &opts);
getmntopts(optarg, mopts, &mntflags, NULL);
break;
case 'v':
verbose++;

View File

@ -129,7 +129,7 @@ int
main(int argc, char *argv[])
{
struct iovec *iov;
int ch, mntflags, iovlen;
int ch, iovlen;
char source [MAXPATHLEN], target[MAXPATHLEN], errmsg[255];
char uid_str[20], gid_str[20];
char fstype[] = "unionfs";
@ -137,7 +137,6 @@ main(int argc, char *argv[])
iov = NULL;
iovlen = 0;
mntflags = 0;
memset(errmsg, 0, sizeof(errmsg));
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, "errmsg", errmsg, sizeof(errmsg));
if (nmount(iov, iovlen, mntflags))
if (nmount(iov, iovlen, 0))
err(EX_OSERR, "%s: %s", source, errmsg);
exit(0);
}