Merge pull request #2911 from cgwalters/fix-generator-regression

Fix return value of generator on non-ostree systems
This commit is contained in:
Dan Nicholson 2023-06-29 02:16:52 -06:00 committed by GitHub
commit c2ad2d23ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -153,7 +153,7 @@ get_ostree_target (void)
autofree char *ostree_cmdline = read_proc_cmdline_key ("ostree"); autofree char *ostree_cmdline = read_proc_cmdline_key ("ostree");
if (!ostree_cmdline) if (!ostree_cmdline)
errx (EXIT_FAILURE, "No ostree= cmdline"); return NULL;
if (strcmp (ostree_cmdline, "aboot") == 0) if (strcmp (ostree_cmdline, "aboot") == 0)
return get_aboot_root_slot (); return get_aboot_root_slot ();

View File

@ -157,6 +157,8 @@ resolve_deploy_path (const char *root_mountpoint)
struct stat stbuf; struct stat stbuf;
char *deploy_path; char *deploy_path;
autofree char *ostree_target = get_ostree_target (); autofree char *ostree_target = get_ostree_target ();
if (!ostree_target)
errx (EXIT_FAILURE, "No ostree= cmdline");
if (snprintf (destpath, sizeof (destpath), "%s/%s", root_mountpoint, ostree_target) < 0) if (snprintf (destpath, sizeof (destpath), "%s/%s", root_mountpoint, ostree_target) < 0)
err (EXIT_FAILURE, "failed to assemble ostree target path"); err (EXIT_FAILURE, "failed to assemble ostree target path");

View File

@ -64,6 +64,8 @@ main (int argc, char *argv[])
* is PID 1 (and so hasn't created /run/ostree-booted). * is PID 1 (and so hasn't created /run/ostree-booted).
*/ */
autofree char *ostree_target = get_ostree_target (); autofree char *ostree_target = get_ostree_target ();
if (!ostree_target)
exit (EXIT_SUCCESS);
/* See comments in ostree-prepare-root.c for this. /* See comments in ostree-prepare-root.c for this.
* *