* [PATCH] evaluate getenv() return value for udev_config.c
@ 2004-05-14 0:19 Leann Ogasawara
2004-05-14 22:20 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Leann Ogasawara @ 2004-05-14 0:19 UTC (permalink / raw)
To: linux-hotplug
Hi All,
Small patch to fix the evaluation logic for the return value of getenv()
in udev_config.c file. Basically, the actual values for the environment
variables "UDEV_NO_SLEEP" and "UDEV_NO_DEVD" were not being checked.
For example UDEV_NO_SLEEP could have been set to false but the line:
if (getenv("UDEV_NO_SLEEP") != NULL)
in this case would always evaluate to true, since getenv() returns
char*, thus the "udev_sleep" variable would be set incorrectly. The
patch makes sure to check the value returned by getenv() not just if
getenv() returned a value. Hope this made sense. Thanks,
Leann
Should apply cleanly to last udev tree (version 025 I believe).
=== udev_config.c 1.18 vs edited ==--- 1.18/udev_config.c Thu Apr 22 07:56:22 2004
+++ edited/udev_config.c Thu May 13 15:42:51 2004
@@ -60,11 +60,15 @@
return 1;
if (strcasecmp(str, "yes") = 0)
return 1;
+ if (strcasecmp(str, "1") = 0)
+ return 1;
return 0;
}
static void init_variables(void)
{
+ char *env;
+
/* fill up the defaults.
* If any config values are specified, they will
* override these values. */
@@ -76,11 +80,13 @@
udev_log = string_is_true(UDEV_LOG_DEFAULT);
udev_sleep = 1;
- if (getenv("UDEV_NO_SLEEP") != NULL)
+ env = getenv("UDEV_NO_SLEEP");
+ if (env && string_is_true(env))
udev_sleep = 0;
udev_dev_d = 1;
- if (getenv("UDEV_NO_DEVD") != NULL)
+ env = getenv("UDEV_NO_DEVD");
+ if (env && string_is_true(env))
udev_dev_d = 0;
}
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] evaluate getenv() return value for udev_config.c
2004-05-14 0:19 [PATCH] evaluate getenv() return value for udev_config.c Leann Ogasawara
@ 2004-05-14 22:20 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-05-14 22:20 UTC (permalink / raw)
To: linux-hotplug
On Thu, May 13, 2004 at 05:19:13PM -0700, Leann Ogasawara wrote:
> Hi All,
>
> Small patch to fix the evaluation logic for the return value of getenv()
> in udev_config.c file. Basically, the actual values for the environment
> variables "UDEV_NO_SLEEP" and "UDEV_NO_DEVD" were not being checked.
> For example UDEV_NO_SLEEP could have been set to false but the line:
>
> if (getenv("UDEV_NO_SLEEP") != NULL)
>
> in this case would always evaluate to true, since getenv() returns
> char*, thus the "udev_sleep" variable would be set incorrectly. The
> patch makes sure to check the value returned by getenv() not just if
> getenv() returned a value. Hope this made sense. Thanks,
>
> Leann
>
> Should apply cleanly to last udev tree (version 025 I believe).
Applied, thanks.
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-05-14 22:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-14 0:19 [PATCH] evaluate getenv() return value for udev_config.c Leann Ogasawara
2004-05-14 22:20 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).