Small bugfixes (point not getting marked in one case, string not NUL and
wrong size in the other.) Submitted by: Martin Blapp <mb@imp.ch>
This commit is contained in:
parent
cd4ace0c76
commit
0fe9a7da10
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52440
@ -65,7 +65,7 @@ static const char rcsid[] =
|
|||||||
typedef enum { MNTON, MNTFROM, NOTHING } mntwhat;
|
typedef enum { MNTON, MNTFROM, NOTHING } mntwhat;
|
||||||
typedef enum { MARK, UNMARK, NAME, COUNT, FREE } dowhat;
|
typedef enum { MARK, UNMARK, NAME, COUNT, FREE } dowhat;
|
||||||
|
|
||||||
int fflag, vflag, count;
|
int fflag, vflag;
|
||||||
char *nfshost;
|
char *nfshost;
|
||||||
|
|
||||||
void checkmntlist (char *, char **, char **, char **);
|
void checkmntlist (char *, char **, char **, char **);
|
||||||
@ -93,7 +93,7 @@ main(int argc, char *argv[])
|
|||||||
/* Start disks transferring immediately. */
|
/* Start disks transferring immediately. */
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
all = count = errs = 0;
|
all = errs = 0;
|
||||||
while ((ch = getopt(argc, argv, "Aafh:t:v")) != -1)
|
while ((ch = getopt(argc, argv, "Aafh:t:v")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -243,11 +243,11 @@ umountfs(char *name, char **typelist)
|
|||||||
struct timeval pertry, try;
|
struct timeval pertry, try;
|
||||||
CLIENT *clp;
|
CLIENT *clp;
|
||||||
size_t len;
|
size_t len;
|
||||||
int so, speclen;
|
int so, speclen, do_rpc;
|
||||||
char *mntonname, *mntfromname;
|
char *mntonname, *mntfromname;
|
||||||
char *mntfromnamerev;
|
char *mntfromnamerev;
|
||||||
char *nfsdirname, *orignfsdirname;
|
char *nfsdirname, *orignfsdirname;
|
||||||
char *resolved, realname[MAXPATHLEN + 1];
|
char *resolved, realname[MAXPATHLEN];
|
||||||
char *type, *delimp, *hostp, *origname;
|
char *type, *delimp, *hostp, *origname;
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
@ -387,13 +387,11 @@ umountfs(char *name, char **typelist)
|
|||||||
* happen before unmount(2), but it should happen
|
* happen before unmount(2), but it should happen
|
||||||
* after the previous namecheck.
|
* after the previous namecheck.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(type, "nfs")) {
|
if (strcmp(type, "nfs") == 0 && getmntname(mntfromname, NULL, NOTHING,
|
||||||
if (getmntname(mntfromname, NULL, NOTHING,
|
&type, COUNT) != NULL)
|
||||||
&type, COUNT) == NULL)
|
do_rpc = 1;
|
||||||
count = 1;
|
else
|
||||||
else
|
do_rpc = 0;
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
if (!namematch(hp))
|
if (!namematch(hp))
|
||||||
return (1);
|
return (1);
|
||||||
if (unmount(mntonname, fflag) != 0 ) {
|
if (unmount(mntonname, fflag) != 0 ) {
|
||||||
@ -406,7 +404,7 @@ umountfs(char *name, char **typelist)
|
|||||||
* Report to mountd-server which nfsname
|
* Report to mountd-server which nfsname
|
||||||
* has been unmounted.
|
* has been unmounted.
|
||||||
*/
|
*/
|
||||||
if (hp != NULL && !(fflag & MNT_FORCE) && count == 0) {
|
if (hp != NULL && !(fflag & MNT_FORCE) && do_rpc) {
|
||||||
memset(&saddr, 0, sizeof(saddr));
|
memset(&saddr, 0, sizeof(saddr));
|
||||||
saddr.sin_family = AF_INET;
|
saddr.sin_family = AF_INET;
|
||||||
saddr.sin_port = 0;
|
saddr.sin_port = 0;
|
||||||
@ -521,8 +519,10 @@ getmntname(const char *fromname, const char *onname,
|
|||||||
if (strcmp(mntbuf[i].f_mntfromname, fromname) == 0) {
|
if (strcmp(mntbuf[i].f_mntfromname, fromname) == 0) {
|
||||||
if (mntcount[i] == 1)
|
if (mntcount[i] == 1)
|
||||||
count--;
|
count--;
|
||||||
else
|
else {
|
||||||
mntcount[i] = 1;
|
mntcount[i] = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count <= 1)
|
if (count <= 1)
|
||||||
@ -612,7 +612,7 @@ getrealname(char *name, char *realname)
|
|||||||
strcpy(realname, "/");
|
strcpy(realname, "/");
|
||||||
else {
|
else {
|
||||||
if ((dirname = strrchr(name + 1, '/')) == NULL)
|
if ((dirname = strrchr(name + 1, '/')) == NULL)
|
||||||
strncpy(realname, name, MAXPATHLEN);
|
snprintf(realname, MAXPATHLEN, "%s", name);
|
||||||
else
|
else
|
||||||
havedir = 1;
|
havedir = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user