diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-05-29 00:09:57 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-05-29 00:11:52 -0400 |
commit | 86522281f8be6e5fca0b3ed552786db4979a45a4 (patch) | |
tree | 5e754a09ac7493b465f649072a2e27d8309f0e6d | |
parent | 606638906a0229323d1b2871fdb0d45ea0e7ff62 (diff) | |
download | e2fsprogs-86522281f8be6e5fca0b3ed552786db4979a45a4.tar.gz |
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>
-rw-r--r-- | lib/ext2fs/ext2_err.et.in | 3 | ||||
-rw-r--r-- | lib/ext2fs/ismounted.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in index 9ffffbb4..406f3ae8 100644 --- a/lib/ext2fs/ext2_err.et.in +++ b/lib/ext2fs/ext2_err.et.in @@ -416,4 +416,7 @@ ec EXT2_ET_EXTENT_INVALID_LENGTH, ec EXT2_ET_IO_CHANNEL_NO_SUPPORT_64, "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 diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c index 4c5500f4..b7f17b84 100644 --- a/lib/ext2fs/ismounted.c +++ b/lib/ext2fs/ismounted.c @@ -53,7 +53,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, *mount_flags = 0; if ((f = setmntent (mtab_file, "r")) == NULL) - return errno; + return (errno == ENOENT ? EXT2_NO_MTAB_FILE : errno); if (stat(file, &st_buf) == 0) { if (S_ISBLK(st_buf.st_mode)) { #ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */ |