diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-30 14:52:10 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-30 14:52:10 +0000 |
commit | 8daa87e21316ef95bbea110d482c89ab6fd192c0 (patch) | |
tree | f8bbb9e0c7984465687d020c6a64bfe952c9f63a /lib/libutil/uucplock.c | |
parent | cf19f8023d2f381cad286f58b3faf5d19fee29d4 (diff) |
Use a constant format string and output the variable part with %s
ok krw@ millert@
Diffstat (limited to 'lib/libutil/uucplock.c')
-rw-r--r-- | lib/libutil/uucplock.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c index bf63f775b34..f38382282ba 100644 --- a/lib/libutil/uucplock.c +++ b/lib/libutil/uucplock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uucplock.c,v 1.18 2016/08/30 14:44:45 guenther Exp $ */ +/* $OpenBSD: uucplock.c,v 1.19 2016/08/30 14:52:09 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -153,7 +153,7 @@ const char * uu_lockerr(int uu_lockresult) { static char errbuf[128]; - char *fmt; + const char *err; switch (uu_lockresult) { case UU_LOCK_INUSE: @@ -161,32 +161,32 @@ uu_lockerr(int uu_lockresult) case UU_LOCK_OK: return ""; case UU_LOCK_OPEN_ERR: - fmt = "open error: %s"; + err = "open error"; break; case UU_LOCK_READ_ERR: - fmt = "read error: %s"; + err = "read error"; break; case UU_LOCK_CREAT_ERR: - fmt = "creat error: %s"; + err = "creat error"; break; case UU_LOCK_WRITE_ERR: - fmt = "write error: %s"; + err = "write error"; break; case UU_LOCK_LINK_ERR: - fmt = "link error: %s"; + err = "link error"; break; case UU_LOCK_TRY_ERR: - fmt = "too many tries: %s"; + err = "too many tries"; break; case UU_LOCK_OWNER_ERR: - fmt = "not locking process: %s"; + err = "not locking process"; break; default: - fmt = "undefined error: %s"; + err = "undefined error"; break; } - (void)snprintf(errbuf, sizeof(errbuf), fmt, strerror(errno)); + (void)snprintf(errbuf, sizeof(errbuf), "%s: %s", err, strerror(errno)); return errbuf; } |