From 491028cc0b08d628f8731be82f1664de985b938f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 13 Jan 2023 21:56:58 +0100 Subject: [PATCH] helpers: fix detection of partition in non-subdirboot layout Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/78fc37b0b155781883d2ca4a6056c55dc686e7f3 Author: vanhofen Date: 2023-01-13 (Fri, 13 Jan 2023) Origin message was: ------------------ - helpers: fix detection of partition in non-subdirboot layout ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index b185d168d..387e0b893 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -2203,6 +2203,7 @@ int getActivePartition() if (strncmp("linuxrootfs", p, 11) == 0) { c = atoi(p + 11); + dprintf(DEBUG_NORMAL, "Current subdirboot partition: %d\n", c); break; } p = strtok(NULL, " ="); @@ -2218,7 +2219,10 @@ int getActivePartition() { if (fseek(f, -2, SEEK_END) == 0) { - c = (int)fgetc(f); + char c2[2] = {0}; + c2[0] = fgetc(f); + c = atoi(c2); + dprintf(DEBUG_NORMAL, "Current partition: %d\n", c); } fclose(f); }