From dd1246eff64cad35d616062f7673014acf7f0d5c Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 30 Nov 2018 23:17:04 +0100 Subject: [PATCH] update: fix commit 19108de408c25e2bda0586273d5645214769e7a7 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/409381fc5c82a604afa1f10bdac58072a90ee1d6 Author: vanhofen Date: 2018-11-30 (Fri, 30 Nov 2018) Origin message was: ------------------ - update: fix commit 19108de408c25e2bda0586273d5645214769e7a7 --- src/gui/update.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index fd9fb882f..84c2fa36f 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -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";