From 91898e2507a05ca38b3ff22b5b944022105e7ae0 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 17 Jun 2023 18:19:58 -0400 Subject: opk/read: Fix device number lengths log10(1) == 0 --- (limited to 'src/opk') diff --git a/src/opk/read.c b/src/opk/read.c index 1e9295b..edfd74f 100644 --- a/src/opk/read.c +++ b/src/opk/read.c @@ -474,6 +474,12 @@ _opkg_opk_opk_read_data(struct opkg_opk_opk *opk) size_len_max = lrint(ceil(log10( size_max))); devmajor_len_max = lrint(ceil(log10(devmajor_max))); devminor_len_max = lrint(ceil(log10(devminor_max))); + if (devmajor_len_max == 0) { + devmajor_len_max = 1; + } + if (devminor_len_max == 0) { + devminor_len_max = 1; + } dev_len_max = devmajor_len_max + 2 /* ", " */ + devminor_len_max; if (dev_len_max > size_len_max) { size_len_max = dev_len_max; -- cgit v0.9.1