[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 2/3] Display a warning message on TAINT_HARDWARE_UNSUPPORTED (#623140).



On Wed, 2010-12-01 at 09:21 -0500, Chris Lumens wrote:
> ---
>  loader/loader.c |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/loader/loader.c b/loader/loader.c
> index 704a986..50f55cd 100644
> --- a/loader/loader.c
> +++ b/loader/loader.c
> @@ -1208,6 +1208,29 @@ static void checkForRam(void) {
>      }
>  }
>  
> +static void checkTaintFlag(void) {
> +    gchar *contents = NULL;
> +    GError *fileErr = NULL;
> +
> +    if (!g_file_get_contents("/proc/sys/kernel/tainted", &contents, NULL, &fileErr)) {
> +        logMessage(ERROR, "error reading /proc/sys/kernel/tainted: %s", fileErr->message);
> +        g_error_free(fileErr);
> +        return;
> +    }
> +
> +    if (g_ascii_strncasecmp(contents, "0", 1)) {
> +        startNewt();
> +        newtWinMessage(_("Unsupported Hardware Detected"), _("OK"),
> +                       _("This hardware (or a combination thereof) is not "
> +                         "supported by Red Hat.  For more information on "
> +                         "supported hardware, please refer to "
> +                         "http://www.redhat.com/hardware.";));
> +        stopNewt();
> +    }
> +
> +    g_free(contents);
> +}
> +
>  static int haveDeviceOfType(int type) {
>      struct device ** devices;
>  
> @@ -2213,6 +2236,8 @@ int main(int argc, char ** argv) {
>          manualDeviceCheck(&loaderData);
>      }
>  
> +    checkTaintFlag();
> +
>      if (loaderData.updatessrc)
>          loadUpdatesFromRemote(loaderData.updatessrc, &loaderData);
>      else if (FL_UPDATES(flags))

Wouldn't it be better to convert the contents to int and compare to 0?
and I guess there's no need to ignore case when comparing something to
"0".

-- 
Martin Gracik <mgracik redhat com>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]