diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-06-17 18:19:58 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-06-17 18:19:58 (EDT) |
commit | 91898e2507a05ca38b3ff22b5b944022105e7ae0 (patch) | |
tree | 92c8b0869f3ad59bf921bc52a3869a34a47b50ac /src | |
parent | ded7f3b79f65b8b627a26b6228c409bf85ccb59c (diff) |
opk/read: Fix device number lengths
log10(1) == 0
Diffstat (limited to 'src')
-rw-r--r-- | src/opk/read.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |