summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ui
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-10-03 06:02:39 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-10-03 06:02:39 +0000
commit37148b59ffd46586cc987e9a6102bdb5e2eac79d (patch)
treee982d5c6d6f1dfbe67984c910dfd328316d37ee2 /lib/libcrypto/ui
parent7672412b3f0d634db8bbf535b5505a712f37fed3 (diff)
Use string literals in printf style calls so gcc's -Wformat works.
ok tedu@, miod@
Diffstat (limited to 'lib/libcrypto/ui')
-rw-r--r--lib/libcrypto/ui/ui_lib.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/libcrypto/ui/ui_lib.c b/lib/libcrypto/ui/ui_lib.c
index baf86d7635b..2c53f534e7c 100644
--- a/lib/libcrypto/ui/ui_lib.c
+++ b/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ui_lib.c,v 1.28 2014/07/22 02:21:20 beck Exp $ */
+/* $OpenBSD: ui_lib.c,v 1.29 2014/10/03 06:02:38 doug Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
* project 2001.
*/
@@ -386,7 +386,6 @@ UI_dup_error_string(UI *ui, const char *text)
char *
UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name)
{
- const char *format = "Enter %s for %s:";
char *prompt;
if (ui->meth->ui_construct_prompt)
@@ -395,10 +394,15 @@ UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name)
if (object_desc == NULL)
return NULL;
- if (object_name == NULL)
- format = "Enter %s:";
- if (asprintf(&prompt, format, object_desc, object_name) == -1)
- return NULL;
+
+ if (object_name == NULL) {
+ if (asprintf(&prompt, "Enter %s:", object_desc) == -1)
+ return (NULL);
+ } else {
+ if (asprintf(&prompt, "Enter %s for %s:", object_desc,
+ object_name) == -1)
+ return (NULL);
+ }
return prompt;
}