From 630b7a860b1e44f84f9fe2f12dfdfff5ffa42ca4 Mon Sep 17 00:00:00 2001 From: brking Date: Thu, 15 Dec 2005 02:10:07 +0000 Subject: [PATCH] Use a default hotplug path if the firmware hotplug config file cannot be found. --- iprlib.c | 10 +++++++--- iprlib.h | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/iprlib.c b/iprlib.c index 7de9c6b..3ea0795 100644 --- a/iprlib.c +++ b/iprlib.c @@ -10,7 +10,7 @@ */ /* - * $Header: /cvsroot/iprdd/iprutils/iprlib.c,v 1.82 2005/12/14 22:29:10 brking Exp $ + * $Header: /cvsroot/iprdd/iprutils/iprlib.c,v 1.83 2005/12/15 02:10:07 brking Exp $ */ #ifndef iprlib_h @@ -4154,8 +4154,12 @@ static int ipr_get_hotplug_dir() file = fopen(FIRMWARE_HOTPLUG_CONFIG_FILE, "r"); if (!file) { - syslog(LOG_ERR, "Failed to open %s. %m\n", FIRMWARE_HOTPLUG_CONFIG_FILE); - return -EIO; + hotplug_dir = realloc(hotplug_dir, strlen(FIRMWARE_HOTPLUG_DEFAULT_DIR) + 1); + if (!hotplug_dir) + return -ENOMEM; + + strcpy(hotplug_dir, FIRMWARE_HOTPLUG_DEFAULT_DIR); + return 0; } clearerr(file); diff --git a/iprlib.h b/iprlib.h index 5302694..957459f 100644 --- a/iprlib.h +++ b/iprlib.h @@ -12,7 +12,7 @@ */ /* - * $Header: /cvsroot/iprdd/iprutils/iprlib.h,v 1.68 2005/12/07 23:27:52 brking Exp $ + * $Header: /cvsroot/iprdd/iprutils/iprlib.h,v 1.69 2005/12/15 02:10:07 brking Exp $ */ #include @@ -62,6 +62,7 @@ #define FIRMWARE_HOTPLUG_DIR_TAG "FIRMWARE_DIR" #define FIRMWARE_HOTPLUG_CONFIG_FILE "/etc/hotplug/firmware.agent" +#define FIRMWARE_HOTPLUG_DEFAULT_DIR LINUX_UCODE_BASE_DIR #define IOCTL_BUFFER_SIZE 512 #define IPR_MAX_NUM_BUSES 4