From: deraadt Date: Sat, 10 Feb 2024 15:29:04 +0000 (+0000) Subject: If anything goes wrong with reading the 'sysctl hw.ucomnames', act X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f928e069fd289488df195b70c9711358f6b8010a;p=openbsd 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 --- 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 @@ -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; }