diff options
author | David Greenman <dg@FreeBSD.org> | 1994-11-04 17:51:37 +0000 |
---|---|---|
committer | David Greenman <dg@FreeBSD.org> | 1994-11-04 17:51:37 +0000 |
commit | 5974081ceaa57620e52a7ac01c1d9fddbcee4a01 (patch) | |
tree | 7167f55af6121357242cba8ca459aa938b10820d | |
parent | fce9eaf109a76d84bbe96c8295174ee321112893 (diff) | |
download | src-5974081ceaa57620e52a7ac01c1d9fddbcee4a01.tar.gz src-5974081ceaa57620e52a7ac01c1d9fddbcee4a01.zip |
From njw@cs.city.ac.uk (Nick Williams):
/sbin/umount does not return the correct exit status due to incorrect
logic in its internals.
Further, because of the nature of the code, you *cannot* use it to
umount a directory from a union mountpoint. Well, you can sometimes,
it depends on if the directory is at the top of the union stack or not :)
Submitted by: njw@cs.city.ac.uk (Nick Williams)
Notes
Notes:
svn path=/head/; revision=4142
-rw-r--r-- | sbin/umount/umount.8 | 22 | ||||
-rw-r--r-- | sbin/umount/umount.c | 8 |
2 files changed, 26 insertions, 4 deletions
diff --git a/sbin/umount/umount.8 b/sbin/umount/umount.8 index 234eb8f18384..d1d02d018a5a 100644 --- a/sbin/umount/umount.8 +++ b/sbin/umount/umount.8 @@ -116,6 +116,28 @@ file system table .Xr unmount 2 , .Xr fstab 5 , .Xr mount 8 +.Sh BUGS +When using union filesystems, +.Xr umount 8 +cannot always determine the node which is the mountpoint. +In this case, +it is necessary to specify the relevant directory to be unmounted +in the same form as that displayed by +.Xr mount 8 . +For example, given a mount entry like this: +.Bd -literal -offset indent +<above>/tmpdir on /cdrom (local, user mount) +.Ed +.Pp +then the command: +.Bd -literal -offset indent +umount '<above>/tmpdir' +.Ed +.Pp +would unmount +.Ar /tmpdir +from the mountpoint +.Ar /cdrom . .Sh HISTORY A .Nm umount diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index 56660dea6840..9059babdc90e 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -128,8 +128,7 @@ main(argc, argv) errs = umountall(); } else for (errs = 0; *argv != NULL; ++argv) - if (umountfs(*argv) == 0) - errs = 1; + errs += umountfs(*argv); exit(errs); } @@ -174,6 +173,7 @@ umountall() return (0); } +/* Returns 1 on failure, 0 on success */ int umountfs(name) char *name; @@ -188,8 +188,8 @@ umountfs(name) char *delimp, *hostp, *mntpt, rname[MAXPATHLEN]; if (realpath(name, rname) == NULL) { - warn("%s", rname); - return (0); + /* Continue and let the system call check it... */ + strcpy(rname, name); } name = rname; |