Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev Don't use conditional format strings, i...
details: https://anonhg.NetBSD.org/src/rev/3d3e0f165774
branches: trunk
changeset: 326845:3d3e0f165774
user: joerg <joerg%NetBSD.org@localhost>
date: Thu Feb 20 11:00:40 2014 +0000
description:
Don't use conditional format strings, if they aren't equivalent in the
arguments they use.
diffstat:
sys/arch/sparc64/dev/lom.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (33 lines):
diff -r 83cd5d113969 -r 3d3e0f165774 sys/arch/sparc64/dev/lom.c
--- a/sys/arch/sparc64/dev/lom.c Thu Feb 20 09:42:42 2014 +0000
+++ b/sys/arch/sparc64/dev/lom.c Thu Feb 20 11:00:40 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lom.c,v 1.11 2013/01/24 11:06:20 nakayama Exp $ */
+/* $NetBSD: lom.c,v 1.12 2014/02/20 11:00:40 joerg Exp $ */
/* $OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.11 2013/01/24 11:06:20 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.12 2014/02/20 11:00:40 joerg Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -352,8 +352,12 @@
for (i = 0; i < sc->sc_num_alarm; i++) {
sc->sc_alarm[i].units = ENVSYS_INDICATOR;
sc->sc_alarm[i].state = ENVSYS_SINVALID;
- snprintf(sc->sc_alarm[i].desc, sizeof(sc->sc_alarm[i].desc),
- i == 0 ? "Fault LED" : "Alarm%d", i);
+ if (i == 0)
+ strlcpy(sc->sc_alarm[i].desc, "Fault LED",
+ sizeof(sc->sc_alarm[i].desc));
+ else
+ snprintf(sc->sc_alarm[i].desc,
+ sizeof(sc->sc_alarm[i].desc), "Alarm%d", i);
if (sysmon_envsys_sensor_attach(sc->sc_sme, &sc->sc_alarm[i])) {
sysmon_envsys_destroy(sc->sc_sme);
aprint_error_dev(self, "can't attach alarm sensor\n");
Home |
Main Index |
Thread Index |
Old Index