Skip to content

Commit 8d59d14

Browse files
committed
OS (Linux): clean up dietpi related code
1 parent ed18839 commit 8d59d14

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/detection/os/os_linux.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,27 +237,26 @@ FF_MAYBE_UNUSED static bool detectDebianDerived(FFOSResult* result)
237237
if (ffPathExists("/boot/dietpi/.version", FF_PATHTYPE_FILE))
238238
{
239239
// DietPi
240-
ffStrbufSetS(&result->id, "dietpi");
241-
ffStrbufSetS(&result->name, "DietPi");
242-
ffStrbufClear(&result->version);
240+
ffStrbufSetStatic(&result->id, "dietpi");
241+
ffStrbufSetStatic(&result->name, "DietPi");
242+
ffStrbufSetStatic(&result->prettyName, "DietPi");
243+
FF_STRBUF_AUTO_DESTROY core = ffStrbufCreate();
243244
FF_STRBUF_AUTO_DESTROY sub = ffStrbufCreate();
244245
FF_STRBUF_AUTO_DESTROY rc = ffStrbufCreate();
245246
if (ffParsePropFileValues("/boot/dietpi/.version", 3, (FFpropquery[]) {
246-
{"G_DIETPI_VERSION_CORE=", &result->version},
247+
{"G_DIETPI_VERSION_CORE=", &core},
247248
{"G_DIETPI_VERSION_SUB=", &sub},
248249
{"G_DIETPI_VERSION_RC=", &rc},
249-
})) ffStrbufAppendF(&result->version, ".%s.%s", sub.chars, rc.chars);
250-
ffStrbufSet(&result->versionID, &result->version);
251-
ffStrbufSetF(&result->prettyName, "DietPi %s", result->version.chars);
250+
})) ffStrbufAppendF(&result->prettyName, " %s.%s.%s", core.chars, sub.chars, rc.chars);
252251
}
253252
else
254253
{
255254
// Raspberry Pi OS
256-
ffStrbufSetS(&result->id, "raspbian");
257-
ffStrbufSetS(&result->name, "Raspberry Pi OS");
258-
ffStrbufSetS(&result->prettyName, "Raspberry Pi OS");
259-
return true;
255+
ffStrbufSetStatic(&result->id, "raspbian");
256+
ffStrbufSetStatic(&result->name, "Raspberry Pi OS");
257+
ffStrbufSetStatic(&result->prettyName, "Raspberry Pi OS");
260258
}
259+
return true;
261260
}
262261
else if (ffStrbufEndsWithS(&instance.state.platform.sysinfo.release, "+truenas"))
263262
{

0 commit comments

Comments
 (0)