diff options
author | mux <mux@FreeBSD.org> | 2005-05-27 00:05:16 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2005-05-27 00:05:16 +0000 |
commit | 48bb027b5ae93fe98cf24916e555a93edfeee4c3 (patch) | |
tree | 0a16b192ffd154871be392e8257e6d5ed063bd51 /usr.sbin/rpc.umntall | |
parent | 9a04b0d3130811adb4362149285064314463a9d6 (diff) | |
download | FreeBSD-src-48bb027b5ae93fe98cf24916e555a93edfeee4c3.zip FreeBSD-src-48bb027b5ae93fe98cf24916e555a93edfeee4c3.tar.gz |
Use clnt_create_timed() instead of clnt_create(). The former has an
additional argument that allows us to specify a timeout, like we do for
the subsequent clnt_call() calls.
Submitted by: Jeremie Le Hen <jeremie@le-hen.org>
MFC after: 3 weeks
Diffstat (limited to 'usr.sbin/rpc.umntall')
-rw-r--r-- | usr.sbin/rpc.umntall/rpc.umntall.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/rpc.umntall/rpc.umntall.c b/usr.sbin/rpc.umntall/rpc.umntall.c index 0ce1ce2..b79e478 100644 --- a/usr.sbin/rpc.umntall/rpc.umntall.c +++ b/usr.sbin/rpc.umntall/rpc.umntall.c @@ -174,14 +174,15 @@ do_umntall(char *hostname) { struct timeval try; CLIENT *clp; - clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); + try.tv_sec = 3; + try.tv_usec = 0; + clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", + &try); if (clp == NULL) { warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); return (0); } clp->cl_auth = authunix_create_default(); - try.tv_sec = 3; - try.tv_usec = 0; clnt_stat = clnt_call(clp, RPCMNT_UMNTALL, (xdrproc_t)xdr_void, (caddr_t)0, (xdrproc_t)xdr_void, (caddr_t)0, try); @@ -201,14 +202,15 @@ do_umount(char *hostname, char *dirp) { struct timeval try; CLIENT *clp; - clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); + try.tv_sec = 3; + try.tv_usec = 0; + clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", + &try); if (clp == NULL) { warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); return (0); } clp->cl_auth = authsys_create_default(); - try.tv_sec = 3; - try.tv_usec = 0; clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, (xdrproc_t)xdr_dir, dirp, (xdrproc_t)xdr_void, (caddr_t)0, try); if (clnt_stat != RPC_SUCCESS) |