mirror of https://github.com/vitalif/e2fsprogs
libext2fs: Add an explicit error code for missing mtab file
To reduce user confusion, if the /etc/mtab file is missing ext2fs_check_mount_point and ext2fs_check_if_mounted will return a new, explicit error code to indicate this case. Addresses-Debian-Bug: #527859 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
606638906a
commit
86522281f8
|
@ -416,4 +416,7 @@ ec EXT2_ET_EXTENT_INVALID_LENGTH,
|
||||||
ec EXT2_ET_IO_CHANNEL_NO_SUPPORT_64,
|
ec EXT2_ET_IO_CHANNEL_NO_SUPPORT_64,
|
||||||
"I/O Channel does not support 64-bit block numbers"
|
"I/O Channel does not support 64-bit block numbers"
|
||||||
|
|
||||||
|
ec EXT2_NO_MTAB_FILE,
|
||||||
|
"Can't check if filesystem is mounted due to missing mtab file"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
|
||||||
|
|
||||||
*mount_flags = 0;
|
*mount_flags = 0;
|
||||||
if ((f = setmntent (mtab_file, "r")) == NULL)
|
if ((f = setmntent (mtab_file, "r")) == NULL)
|
||||||
return errno;
|
return (errno == ENOENT ? EXT2_NO_MTAB_FILE : errno);
|
||||||
if (stat(file, &st_buf) == 0) {
|
if (stat(file, &st_buf) == 0) {
|
||||||
if (S_ISBLK(st_buf.st_mode)) {
|
if (S_ISBLK(st_buf.st_mode)) {
|
||||||
#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
|
#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
|
||||||
|
|
Loading…
Reference in New Issue