From b4ee1fb28e9aeea982cbbdef873604224ce45445 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 2 Feb 2000 19:08:51 +0000 Subject: [PATCH] ChangeLog, fsck.c, mke2fs.c, partinfo.c: fsck.c (interpret_device): If there was an attempt to interpret a device specification of the type "UUID=" or "LABEL=", and it fails, check to see if /proc/partitions is readable. If not, print a warning message about /proc perhaps not being mounted, and exit. mke2fs.c (check_plausibility): Remove unneeded #include of linux/fs.h. Add #define of MAJOR if necessary. partinfo.c: Remove unneeded #include of linux/fs.h --- misc/ChangeLog | 13 +++++++++++++ misc/fsck.c | 14 +++++++++++++- misc/mke2fs.c | 8 +++++--- misc/partinfo.c | 1 - 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/misc/ChangeLog b/misc/ChangeLog index cea78ab..f78ec95 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,16 @@ +2000-02-02 Theodore Ts'o + + * fsck.c (interpret_device): If there was an attempt to interpret + a device specification of the type "UUID=" or "LABEL=", + and it fails, check to see if /proc/partitions is + readable. If not, print a warning message about /proc + perhaps not being mounted, and exit. + + * mke2fs.c (check_plausibility): Remove unneeded #include of + linux/fs.h. Add #define of MAJOR if necessary. + + * partinfo.c: Remove unneeded #include of linux/fs.h + 2000-01-19 Theodore Ts'o * tune2fs.c (usage): Update the usage message to correctly diff --git a/misc/fsck.c b/misc/fsck.c index 349a74c..9b42820 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -257,9 +257,21 @@ static char *interpret_device(char *spec) dev = get_spec_by_uuid(spec+5); else if (!strncmp(spec, "LABEL=", 6)) dev = get_spec_by_volume_label(spec+6); + else + return spec; if (dev) { free(spec); - spec = dev; + return (dev); + } + /* + * Check to see if this was because /proc/partitions isn't + * found. + */ + if (access("/proc/partitions", R_OK) < 0) { + fprintf(stderr, "Couldn't open /proc/partitions: %s\n", + strerror(errno)); + fprintf(stderr, "Is /proc mounted?\n"); + exit(1); } return spec; } diff --git a/misc/mke2fs.c b/misc/mke2fs.c index df0b878..ef62722 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -41,9 +41,6 @@ #include #include -#ifdef HAVE_LINUX_FS_H -#include -#endif #include #ifdef HAVE_LINUX_MAJOR_H #include @@ -138,6 +135,11 @@ static void proceed_question(NOARGS) static void check_plausibility(NOARGS) { #ifdef HAVE_LINUX_MAJOR_H +#ifndef MAJOR +#define MAJOR(dev) ((dev)>>8) +#define MINOR(dev) ((dev) & 0xff) +#endif + int val; struct stat s; diff --git a/misc/partinfo.c b/misc/partinfo.c index 6ae850f..588a631 100644 --- a/misc/partinfo.c +++ b/misc/partinfo.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include -- 1.8.3.1