]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
updatectl: check: Don't print an empty table
authorAdrian Vovk <adrianvovk@gmail.com>
Thu, 19 Sep 2024 12:33:02 +0000 (08:33 -0400)
committerAdrian Vovk <adrianvovk@gmail.com>
Thu, 19 Sep 2024 12:33:02 +0000 (08:33 -0400)
If there are no updates available, `updatectl check` would previously
just print an empty table. We should instead just tell the user that
there are no updates available.

src/sysupdate/updatectl.c

index af27d0dc80382137e28265dd951c591a28eaabad..602ed1e4bf4ce3625b0c61daaffb9d0fa5c14ee5 100644 (file)
@@ -788,6 +788,11 @@ static int verb_check(int argc, char **argv, void *userdata) {
         if (r < 0)
                 return log_error_errno(r, "Failed to start event loop: %m");
 
+        if (table_isempty(table)) {
+                log_info("No updates available.");
+                return 0;
+        }
+
         return table_print_with_pager(table, SD_JSON_FORMAT_OFF, arg_pager_flags, arg_legend);
 }