]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run: don't show IP/IO accounting data if 0 30902/head
authorMike Yuan <me@yhndnzj.com>
Fri, 12 Jan 2024 09:35:21 +0000 (17:35 +0800)
committerMike Yuan <me@yhndnzj.com>
Fri, 12 Jan 2024 09:35:21 +0000 (17:35 +0800)
src/run/run.c

index e94ae2abbe68e6ba41c9d12a5fd91b259d6e86c4..3f54bd5607d3942d1f392e801a87634acbd7f658 100644 (file)
@@ -1835,9 +1835,9 @@ static int start_transient_service(sd_bus *bus) {
 
                         const char *ip_ingress = NULL, *ip_egress = NULL;
 
-                        if (c.ip_ingress_bytes != UINT64_MAX)
+                        if (!IN_SET(c.ip_ingress_bytes, 0, UINT64_MAX))
                                 ip_ingress = strjoina(" received: ", FORMAT_BYTES(c.ip_ingress_bytes));
-                        if (c.ip_egress_bytes != UINT64_MAX)
+                        if (!IN_SET(c.ip_egress_bytes, 0, UINT64_MAX))
                                 ip_egress = strjoina(" sent: ", FORMAT_BYTES(c.ip_egress_bytes));
 
                         if (ip_ingress || ip_egress)
@@ -1845,9 +1845,9 @@ static int start_transient_service(sd_bus *bus) {
 
                         const char *io_read = NULL, *io_write = NULL;
 
-                        if (c.io_read_bytes != UINT64_MAX)
+                        if (!IN_SET(c.io_read_bytes, 0, UINT64_MAX))
                                 io_read = strjoina(" read: %s", FORMAT_BYTES(c.io_read_bytes));
-                        if (c.io_write_bytes != UINT64_MAX)
+                        if (!IN_SET(c.io_write_bytes, 0, UINT64_MAX))
                                 io_write = strjoina(" written: %s", FORMAT_BYTES(c.io_write_bytes));
 
                         if (io_read || io_write)