mdev_helper/hdd_menu: add udev support

busybox/mdev fills the MDEV variable without /dev/ prefix,
udev fills DEVNAME with /dev/ prefix. Handle both variants.
This commit is contained in:
Stefan Seyfried
2015-02-07 21:38:33 +01:00
committed by Jacek Jendrzej
parent c7dd4260d6
commit d04f7406a7
2 changed files with 15 additions and 8 deletions

View File

@@ -37,10 +37,10 @@ const char *mdev_env[] =
"MDEV" ,
"DEVPATH" ,
"INTERFACE",
"DEVNAME",
NULL /* terminating entry */
};
#define ENV_SIZE (sizeof(mdev_env)/sizeof(char *))
int main (int /*argc*/, char **argv)
{
struct sockaddr_un servaddr;
@@ -64,7 +64,7 @@ int main (int /*argc*/, char **argv)
goto _error;
}
for (unsigned i = 0; i < ENV_SIZE; i++) {
for (unsigned i = 0; mdev_env[i]; i++) {
char * s = getenv(mdev_env[i]);
if (s)
data += std::string(mdev_env[i]) + "=" + s + " ";