X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fstatd%2Fmonitor.c;h=a2c9e2b091c126d2d24b84a870f946f1f479ca68;hb=5d253e3e326bfcf0e8a342bca53f1b4db120a7a9;hp=a6a1d9c225a4443de7a8a21904e6a4cf75748949;hpb=9b13713fa592b02da0dc79c5505fdf7002155d13;p=nfs-utils.git diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c index a6a1d9c..a2c9e2b 100644 --- a/utils/statd/monitor.c +++ b/utils/statd/monitor.c @@ -20,6 +20,8 @@ #include #include #include + +#include "rpcmisc.h" #include "misc.h" #include "statd.h" #include "notlist.h" @@ -36,9 +38,10 @@ notify_list * rtnl = NULL; /* Run-time notify list. */ static int caller_is_localhost(struct svc_req *rqstp) { + struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt); struct in_addr caller; - caller = svc_getcaller(rqstp->rq_xprt)->sin_addr; + caller = sin->sin_addr; if (caller.s_addr != htonl(INADDR_LOOPBACK)) { note(N_WARNING, "Call to statd from non-local host %s", @@ -201,7 +204,10 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp) e += sprintf(e, "%02x", 0xff & (argp->priv[i])); if (e+1-buf != LINELEN) abort(); e += sprintf(e, " %s %s\n", mon_name, my_name); - write(fd, buf, e-buf); + if (write(fd, buf, e-buf) != (e-buf)) { + note(N_WARNING, "writing to %s failed: errno %d (%s)", + path, errno, strerror(errno)); + } } free(path); @@ -352,7 +358,7 @@ sm_unmon_1_svc(struct mon_id *argp, struct svc_req *rqstp) /* PRC: do the HA callout: */ ha_callout("del-client", mon_name, my_name, -1); - xunlink(SM_DIR, clnt->dns_name, 1); + xunlink(SM_DIR, clnt->dns_name); nlist_free(&rtnl, clnt); return (&result); @@ -404,7 +410,7 @@ sm_unmon_all_1_svc(struct my_id *argp, struct svc_req *rqstp) temp = NL_NEXT(clnt); /* PRC: do the HA callout: */ ha_callout("del-client", mon_name, my_name, -1); - xunlink(SM_DIR, clnt->dns_name, 1); + xunlink(SM_DIR, clnt->dns_name); nlist_free(&rtnl, clnt); ++count; clnt = temp;