From: Greg Banks Date: Thu, 22 Jun 2006 08:01:10 +0000 (+1000) Subject: Fix a number of the easier compile warnings: unused variables, X-Git-Tag: nfs-utils-1-0-9~35 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=93608a52655abf5ac23404c4b5cc05fe575a9c04;p=nfs-utils.git Fix a number of the easier compile warnings: unused variables, unused labels, constness, signedness. --- diff --git a/support/export/client.c b/support/export/client.c index c09e762..33dfdb0 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "xmalloc.h" #include "misc.h" diff --git a/support/nfs/conn.c b/support/nfs/conn.c index a020394..bf2afad 100644 --- a/support/nfs/conn.c +++ b/support/nfs/conn.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index c7bff40..8c94ad9 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -228,10 +228,12 @@ rpc_logcall(struct svc_req *rqstp, char *xname, char *arg) break; case AUTH_UNIX: { struct authunix_parms *unix_cred; + time_t time; struct tm *tm; unix_cred = (struct authunix_parms *) rqstp->rq_clntcred; - tm = localtime(&unix_cred->aup_time); + time = unix_cred->aup_time; + tm = localtime(&time); snprintf(sp, buflen, "UNIX %d/%d/%d %02d:%02d:%02d %s %d.%d", tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index c8ce6b2..16b1316 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -541,7 +541,8 @@ nfsdcb(int fd, short which, void *data) struct idmap_client *ic = data; struct idmap_msg im; u_char buf[IDMAP_MAXMSGSZ + 1]; - size_t len, bsiz; + size_t len; + ssize_t bsiz; char *bp, typebuf[IDMAP_MAXMSGSZ], buf1[IDMAP_MAXMSGSZ], authbuf[IDMAP_MAXMSGSZ], *p; unsigned long tmp; @@ -558,7 +559,7 @@ nfsdcb(int fd, short which, void *data) /* Get rid of newline and terminate buffer*/ buf[len - 1] = '\0'; - bp = buf; + bp = (char *)buf; memset(&im, 0, sizeof(im)); @@ -608,7 +609,7 @@ nfsdcb(int fd, short which, void *data) imconv(ic, &im); buf[0] = '\0'; - bp = buf; + bp = (char *)buf; bsiz = sizeof(buf); /* Authentication name */ diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 5285e10..c57d3b0 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -429,7 +429,7 @@ cache_get_filehandle(nfs_export *exp, int len, char *p) if (failed) return NULL; memset(fh.fh_handle, 0, sizeof(fh.fh_handle)); - fh.fh_size = qword_get(&bp, fh.fh_handle, NFS3_FHSIZE); + fh.fh_size = qword_get(&bp, (char *)fh.fh_handle, NFS3_FHSIZE); return &fh; } diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index e402bf8..c1d18d4 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -35,7 +35,7 @@ extern void my_svc_run(void); static void usage(const char *, int exitcode); static exports get_exportlist(void); -static struct nfs_fh_len *get_rootfh(struct svc_req *, dirpath *, int *, int v3); +static struct nfs_fh_len *get_rootfh(struct svc_req *, dirpath *, mountstat3 *, int v3); int new_cache = 0; @@ -346,11 +346,11 @@ mount_mnt_3_svc(struct svc_req *rqstp, dirpath *path, mountres3 *res) struct nfs_fh_len *fh; xlog(D_CALL, "MNT3(%s) called", *path); - if ((fh = get_rootfh(rqstp, path, (int *) &res->fhs_status, 1)) != NULL) { + if ((fh = get_rootfh(rqstp, path, &res->fhs_status, 1)) != NULL) { struct mountres3_ok *ok = &res->mountres3_u.mountinfo; ok->fhandle.fhandle3_len = fh->fh_size; - ok->fhandle.fhandle3_val = fh->fh_handle; + ok->fhandle.fhandle3_val = (char *)fh->fh_handle; ok->auth_flavors.auth_flavors_len = sizeof(flavors)/sizeof(flavors[0]); ok->auth_flavors.auth_flavors_val = flavors; @@ -359,7 +359,7 @@ mount_mnt_3_svc(struct svc_req *rqstp, dirpath *path, mountres3 *res) } static struct nfs_fh_len * -get_rootfh(struct svc_req *rqstp, dirpath *path, int *error, int v3) +get_rootfh(struct svc_req *rqstp, dirpath *path, mountstat3 *error, int v3) { struct sockaddr_in *sin = (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt); diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c index 8348473..98cbf4a 100644 --- a/utils/statd/monitor.c +++ b/utils/statd/monitor.c @@ -268,7 +268,9 @@ sm_unmon_1_svc(struct mon_id *argp, struct svc_req *rqstp) clnt = NL_NEXT(clnt); } +#ifdef RESTRICTED_STATD failure: +#endif note(N_WARNING, "Received erroneous SM_UNMON request from %s for %s", my_name, mon_name); return (&result); @@ -336,6 +338,8 @@ sm_unmon_all_1_svc(struct my_id *argp, struct svc_req *rqstp) dprintf(N_DEBUG, "SM_UNMON_ALL request from %s with no " "SM_MON requests from it.", my_name); } +#ifdef RESTRICTED_STATD failure: +#endif return (&result); } diff --git a/utils/statd/statd.c b/utils/statd/statd.c index 8ebb808..c92e12f 100644 --- a/utils/statd/statd.c +++ b/utils/statd/statd.c @@ -51,7 +51,7 @@ int run_mode = 0; /* foreground logging mode */ * two copies of each - one in main(), one static in log.c... * It also eliminates the 256-char static in log.c */ char *name_p = NULL; -char *version_p = NULL; +const char *version_p = NULL; /* PRC: a high-availability callout program can be specified with -H * When this is done, the program will receive callouts whenever clients @@ -374,7 +374,7 @@ int main (int argc, char **argv) #endif if (!(run_mode & MODE_NODAEMON)) { - int filedes, fdmax, tempfd; + int tempfd; if (pipe(pipefds)<0) { perror("statd: unable to create pipe"); diff --git a/utils/statd/statd.h b/utils/statd/statd.h index 225cc8b..ace2ce5 100644 --- a/utils/statd/statd.h +++ b/utils/statd/statd.h @@ -88,6 +88,6 @@ extern int run_mode; * as to why they're global. */ extern char *name_p; /* program basename */ -extern char *version_p; /* program version */ +extern const char *version_p; /* program version */ extern int re_notify; /* time to re-read notify list */ diff --git a/utils/statd/state.c b/utils/statd/state.c index a6a4077..f46dae5 100644 --- a/utils/statd/state.c +++ b/utils/statd/state.c @@ -28,7 +28,6 @@ void change_state (void) { int fd, size; - extern short int restart; if ((fd = open (SM_STAT_PATH, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) == -1) die ("open (%s): %s", SM_STAT_PATH, strerror (errno));