summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2024-02-10 15:29:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2024-02-10 15:29:05 +0000
commit0d2f8a19e96e2cca022c4c87b0e226376f78ace9 (patch)
tree5d9427c7d93748b9c9af692f3901def142782ccf /usr.bin
parent3f7d3981d2d9d1546a12150ced0d9418f1a5592b (diff)
If anything goes wrong with reading the 'sysctl hw.ucomnames', act
like it is the empty string, rather than considering it an error. ok krw
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cu/cu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/cu/cu.c b/usr.bin/cu/cu.c
index b6e7a476916..323f5eea5f2 100644
--- a/usr.bin/cu/cu.c
+++ b/usr.bin/cu/cu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cu.c,v 1.30 2023/12/21 11:25:38 jca Exp $ */
+/* $OpenBSD: cu.c,v 1.31 2024/02/10 15:29:04 deraadt Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
@@ -488,13 +488,13 @@ get_ucomnames(void)
size = 0;
for (;;) {
if (sysctl(mib, 2, NULL, &size, NULL, 0) == -1 || size == 0)
- err(1, "hw.ucomnames");
+ return NULL;
if ((names = realloc(names, size)) == NULL)
err(1, NULL);
if (sysctl(mib, 2, names, &size, NULL, 0) != -1)
break;
if (errno != ENOMEM)
- err(1, "hw.ucomnames");
+ return NULL;
}
return names;
}