update: fix commit 19108de408

Origin commit data
------------------
Commit: 409381fc5c
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-11-30 (Fri, 30 Nov 2018)

Origin message was:
------------------
- update: fix commit 19108de408
This commit is contained in:
vanhofen
2018-11-30 23:17:04 +01:00
parent 19108de408
commit dd1246eff6

View File

@@ -582,9 +582,9 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
showGlobalStatus(60);
dprintf(DEBUG_NORMAL, "[update] flash/install filename %s type %c\n", filename.c_str(), fileType);
if (gotImage)
if (gotImage && (fileType <= '9')) // flashing image
{
//flash it...
#if ENABLE_EXTUPDATE
#ifndef BOXMODEL_CS_HD2
if (g_settings.apply_settings) {
@@ -616,23 +616,8 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
sleep(2);
ft.reboot();
}
else if(fileType == 'T') // display file contents
{
FILE* fd = fopen(filename.c_str(), "r");
if(fd) {
char * buffer;
off_t filesize = lseek(fileno(fd), 0, SEEK_END);
lseek(fileno(fd), 0, SEEK_SET);
buffer =(char *) malloc((uint32_t)filesize+1);
fread(buffer, (uint32_t)filesize, 1, fd);
fclose(fd);
buffer[filesize] = 0;
ShowMsg(LOCALE_MESSAGEBOX_INFO, buffer, CMsgBox::mbrBack, CMsgBox::mbBack);
free(buffer);
}
}
#if HAVE_ARM_HARDWARE
else if (fileType == 'Z')
else if (gotImage && (fileType == 'Z')) // flashing image with ofgwrite
{
showGlobalStatus(100);
@@ -733,6 +718,21 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_EXIT_ALL;
}
#endif
else if (fileType == 'T') // not image, display file contents
{
FILE* fd = fopen(filename.c_str(), "r");
if(fd) {
char * buffer;
off_t filesize = lseek(fileno(fd), 0, SEEK_END);
lseek(fileno(fd), 0, SEEK_SET);
buffer = (char *) malloc((uint32_t)filesize+1);
fread(buffer, (uint32_t)filesize, 1, fd);
fclose(fd);
buffer[filesize] = 0;
ShowMsg(LOCALE_MESSAGEBOX_INFO, buffer, CMsgBox::mbrBack, CMsgBox::mbBack);
free(buffer);
}
}
else // not image, install
{
const char install_sh[] = TARGET_PREFIX "/bin/install.sh";