Bug#469540: glibc-doc: Documentation of umount() and umount2() wrong
Package: glibc-doc
Version: 2.7-9
Severity: normal
Hi,
the documentation of umount2() (and therefore, for umount() also) says:
"You can identify the filesystem to unmount either by the device special
file that contains the filesystem or by the mount point. The effect is
the same."
However, specifying the device special file doesn't work (while
specifying the mount point works fine).
Example:
myumount.c:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mount.h>
#include <errno.h>
int main(int argc, char*argv[]) {
int ret;
ret = umount("/dev/sda1");
printf("Return: %d, errno = %d\n", ret, errno);
return 0;
}
Shell:
# cat /proc/mounts |grep sda1
/dev/sda1 /mnt/usbdisk vfat rw,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1 0 0
# ./myumount
Return: -1, errno = 22
# cat /proc/mounts |grep sda1
/dev/sda1 /mnt/usbdisk vfat rw,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1 0 0
#
I can reproduce this on different machines, with different device nodes
and kernels.
For the record, using the mount point works:
# ./myumount
Return: 0, errno = 0
#
This is unrelated to MNT_FORCE.
Thanks for considering,
Roland
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-rt1 (SMP w/1 CPU core; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/bash
-- debconf-show failed
Reply to: