and make it clear which messages are remote/RPC errors; EACCESS isn't
a good default in case of failure after retries
SCCS-vsn: sbin/mount/mount.c 5.42
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mount.c 5.41 (Berkeley) %G%";
+static char sccsid[] = "@(#)mount.c 5.42 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
if (flags & MNT_UPDATE)
fprintf(stderr, "Specified device does %s\n",
"not match mounted device");
if (flags & MNT_UPDATE)
fprintf(stderr, "Specified device does %s\n",
"not match mounted device");
+ else if (mnttype == MOUNT_UFS)
fprintf(stderr, "Bogus super block\n");
fprintf(stderr, "Bogus super block\n");
+ else
+ perror((char *)NULL);
break;
case EOPNOTSUPP:
fprintf(stderr, "Operation not supported\n");
break;
case EOPNOTSUPP:
fprintf(stderr, "Operation not supported\n");
struct timeval pertry, try;
enum clnt_stat clnt_stat;
int so = RPC_ANYSOCK;
struct timeval pertry, try;
enum clnt_stat clnt_stat;
int so = RPC_ANYSOCK;
+ char *fsp, *hostp, *delimp;
u_short tport;
static struct nfhret nfhret;
static char nam[MNAMELEN + 1];
u_short tport;
static struct nfhret nfhret;
static char nam[MNAMELEN + 1];
+ char buf[MAXPATHLEN + 1];
+ strncpy(buf, spec, MAXPATHLEN);
+ buf[MAXPATHLEN] = '\0';
strncpy(nam, spec, MNAMELEN);
nam[MNAMELEN] = '\0';
strncpy(nam, spec, MNAMELEN);
nam[MNAMELEN] = '\0';
- if ((delimp = index(spec, '@')) != NULL) {
+ if ((delimp = index(buf, '@')) != NULL) {
- } else if ((delimp = index(spec, ':')) != NULL) {
- hostp = spec;
- spec = delimp + 1;
+ fsp = buf;
+ } else if ((delimp = index(buf, ':')) != NULL) {
+ hostp = buf;
+ fsp = delimp + 1;
} else {
fprintf(stderr,
"No <host>:<dirpath> or <dirpath>@<host> spec\n");
} else {
fprintf(stderr,
"No <host>:<dirpath> or <dirpath>@<host> spec\n");
return (0);
}
bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
return (0);
}
bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
- nfhret.stat = EACCES; /* Mark not yet successful */
+ nfhret.stat = ETIMEDOUT; /* Mark not yet successful */
while (retrycnt > 0) {
saddr.sin_family = AF_INET;
saddr.sin_port = htons(PMAPPORT);
while (retrycnt > 0) {
saddr.sin_family = AF_INET;
saddr.sin_port = htons(PMAPPORT);
try.tv_sec = 10;
try.tv_usec = 0;
clnt_stat = clnt_call(clp, RPCMNT_MOUNT,
try.tv_sec = 10;
try.tv_usec = 0;
clnt_stat = clnt_call(clp, RPCMNT_MOUNT,
- xdr_dir, spec, xdr_fh, &nfhret, try);
+ xdr_dir, fsp, xdr_fh, &nfhret, try);
if (clnt_stat != RPC_SUCCESS) {
if ((opflags & ISBGRND) == 0)
clnt_perror(clp, "Bad MNT RPC");
if (clnt_stat != RPC_SUCCESS) {
if ((opflags & ISBGRND) == 0)
clnt_perror(clp, "Bad MNT RPC");
if (nfhret.stat) {
if (opflags & ISBGRND)
exit(1);
if (nfhret.stat) {
if (opflags & ISBGRND)
exit(1);
- fprintf(stderr, "Can't access %s: ", spec);
+ fprintf(stderr, "Mount RPC error on %s: ", spec);
errno = nfhret.stat;
perror((char *)NULL);
return (0);
errno = nfhret.stat;
perror((char *)NULL);
return (0);