summaryrefslogtreecommitdiffstats
path: root/flashbios
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2017-09-07 14:34:27 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-09-11 19:14:53 +0000
commit0206be87facad3bdc6344e6cd1e92d8908aa212b (patch)
treebd58b08c6911e1f05c2865434a61eea352a119f3 /flashbios
parent2c92f88193eb3cfe46834c33cf400d0d08ed9f42 (diff)
downloadtalos-skeleton-0206be87facad3bdc6344e6cd1e92d8908aa212b.tar.gz
talos-skeleton-0206be87facad3bdc6344e6cd1e92d8908aa212b.zip
flashbios: Do not expect the full path to the executable
The service file that starts the bios flasher was changed from specifying the path /usr/sbin/<flasher> to just <flasher> to allow the service file to find the binary on any directory specified by PATH and enable patching on a read-only filesystem. Remove the parsing of the path from the code, and change execl to execlp which gets the path from the PATH env variable. Resolves openbmc/openbmc#2271 Change-Id: I2b74e287e1e5db8feb96bfe51a0a73d999ba43c2 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'flashbios')
-rw-r--r--flashbios/flash_bios_obj.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/flashbios/flash_bios_obj.c b/flashbios/flash_bios_obj.c
index d34046d..765b7c2 100644
--- a/flashbios/flash_bios_obj.c
+++ b/flashbios/flash_bios_obj.c
@@ -31,11 +31,10 @@ update(Flash* flash, const char* obj_path)
pid = fork();
if(pid == 0)
{
- const gchar* path = flash_get_flasher_path(flash);
const gchar* name = flash_get_flasher_name(flash);
const gchar* inst = flash_get_flasher_instance(flash);
const gchar* filename = flash_get_filename(flash);
- status = execl(path, name, inst, filename, obj_path, NULL);
+ status = execlp(name, name, inst, filename, obj_path, NULL);
return status;
}
return 0;
@@ -242,21 +241,7 @@ on_bus_acquired(GDBusConnection *connection,
manager = g_dbus_object_manager_server_new(dbus_object_path);
int i=0;
- //TODO: don't use fixed buffer
- char flasher_path[512];
- memset(flasher_path, '\0', sizeof(flasher_path));
- gchar *flasher_file = NULL;
- int c = strlen(cmd->argv[0]);
- while(c>0)
- {
- if(cmd->argv[0][c] == '/')
- {
- strncpy(flasher_path,cmd->argv[0],c);
- flasher_file = g_strdup_printf("%s/%s",flasher_path,FLASHER_BIN);
- break;
- }
- c--;
- }
+ gchar *flasher_file = g_strdup_printf("%s", FLASHER_BIN);
const char* inst[] = {"bios"};
for(i=0;i<1;i++)
@@ -277,7 +262,6 @@ on_bus_acquired(GDBusConnection *connection,
shared_resource_set_lock(lock,false);
shared_resource_set_name(lock,"");
- flash_set_flasher_path(flash,flasher_file);
flash_set_flasher_name(flash,FLASHER_BIN);
flash_set_flasher_instance(flash,inst[i]);
//g_free (s);
OpenPOWER on IntegriCloud