SCCS-vsn: sbin/umount/umount.c 5.16
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)umount.c 5.15 (Berkeley) %G%";
+static char sccsid[] = "@(#)umount.c 5.16 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
#endif /* NFS */
if (stat(name, &stbuf) < 0) {
#endif /* NFS */
if (stat(name, &stbuf) < 0) {
- if ((mntpt = getmntname(name, MNTON, &type)) == 0)
+ if (getmntname(name, MNTFROM, &type) != 0)
+ mntpt = name;
+ else if ((mntpt = getmntname(name, MNTON, &type)) == 0) {
+ fprintf(stderr, "%s: not currently mounted\n", name);
} else if ((stbuf.st_mode & S_IFMT) == S_IFBLK) {
} else if ((stbuf.st_mode & S_IFMT) == S_IFBLK) {
- if ((mntpt = getmntname(name, MNTON, &type)) == 0)
+ if ((mntpt = getmntname(name, MNTON, &type)) == 0) {
+ fprintf(stderr, "%s: not currently mounted\n", name);
} else if ((stbuf.st_mode & S_IFMT) == S_IFDIR) {
mntpt = name;
} else if ((stbuf.st_mode & S_IFMT) == S_IFDIR) {
mntpt = name;
- if ((name = getmntname(mntpt, MNTFROM, &type)) == 0)
+ if (getmntname(mntpt, MNTFROM, &type) == 0) {
+ fprintf(stderr, "%s: not currently mounted\n", name);
} else {
fprintf(stderr, "%s: not a directory or special device\n",
name);
} else {
fprintf(stderr, "%s: not a directory or special device\n",
name);
return (mntbuf[i].f_mntfromname);
}
}
return (mntbuf[i].f_mntfromname);
}
}
- fprintf(stderr, "%s: not currently mounted\n", name);