helpers: fix detection of partition in non-subdirboot layout

Origin commit data
------------------
Branch: ni/coolstream
Commit: 78fc37b0b1
Author: vanhofen <vanhofen@gmx.de>
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
This commit is contained in:
vanhofen
2023-01-13 21:56:58 +01:00
parent 7ec5086e53
commit 491028cc0b

View File

@@ -2203,6 +2203,7 @@ int getActivePartition()
if (strncmp("linuxrootfs", p, 11) == 0) if (strncmp("linuxrootfs", p, 11) == 0)
{ {
c = atoi(p + 11); c = atoi(p + 11);
dprintf(DEBUG_NORMAL, "Current subdirboot partition: %d\n", c);
break; break;
} }
p = strtok(NULL, " ="); p = strtok(NULL, " =");
@@ -2218,7 +2219,10 @@ int getActivePartition()
{ {
if (fseek(f, -2, SEEK_END) == 0) 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); fclose(f);
} }