summaryrefslogblamecommitdiff
path: root/system/net-tools/fix-sscanf-format-specifier.patch
blob: e39e0434b82d2e9e4810bf18b29ac2157c636050 (plain) (tree)











































                                                                                    
From d7d325d5fddb0be4601a910fe23066be6c8bd603 Mon Sep 17 00:00:00 2001
From: Zach van Rijn <me@zv.io>
Date: Wed, 21 Jun 2023 16:50:30 +0000
Subject: [PATCH] Revert "sscanf pattern is %Lu not %llu for long long unsigned
 byte counters."

This reverts commit 811cf0aaf40a0e7f426f8ffaea7c3ca4b8bebdfc.

See also: d828f5ce7cbd8d8c5cc4cf8f4a402f9647fa8548.

diff --git a/lib/interface.c b/lib/interface.c
index ef28dec..71d4163 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -254,7 +254,7 @@ static int get_dev_fields(const char *bp, struct interface *ife)
     switch (procnetdev_vsn) {
     case 3:
 	sscanf(bp,
-	"%Lu %Lu %lu %lu %lu %lu %lu %lu %Lu %Lu %lu %lu %lu %lu %lu %lu",
+	"%llu %llu %lu %lu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu %lu",
 	       &ife->stats.rx_bytes,
 	       &ife->stats.rx_packets,
 	       &ife->stats.rx_errors,
@@ -274,7 +274,7 @@ static int get_dev_fields(const char *bp, struct interface *ife)
 	       &ife->stats.tx_compressed);
 	break;
     case 2:
-	sscanf(bp, "%Lu %Lu %lu %lu %lu %lu %Lu %Lu %lu %lu %lu %lu %lu",
+	sscanf(bp, "%llu %llu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu",
 	       &ife->stats.rx_bytes,
 	       &ife->stats.rx_packets,
 	       &ife->stats.rx_errors,
@@ -292,7 +292,7 @@ static int get_dev_fields(const char *bp, struct interface *ife)
 	ife->stats.rx_multicast = 0;
 	break;
     case 1:
-	sscanf(bp, "%Lu %lu %lu %lu %lu %Lu %lu %lu %lu %lu %lu",
+	sscanf(bp, "%llu %lu %lu %lu %lu %llu %lu %lu %lu %lu %lu",
 	       &ife->stats.rx_packets,
 	       &ife->stats.rx_errors,
 	       &ife->stats.rx_dropped,
-- 
2.40.0