From d69b4d8b9b06ab1467903d82d105ff21505f392e Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Fri, 27 Nov 2015 18:07:31 +0000
Subject: [PATCH] cons.saver.c: fix -Wformat-nonliteral warning
Let's decide about fix warning over more fashionable code concept at this single section
cons.saver.c:213:52: warning: format string is not a string literal [-Wformat-nonliteral]
cons.saver.c:220:46: warning: format string is not a string literal [-Wformat-nonliteral]
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/consaver/cons.saver.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/consaver/cons.saver.c b/src/consaver/cons.saver.c
index 372fc55..4cfb4dc 100644
a
|
b
|
main (int argc, char **argv) |
163 | 163 | struct stat st; |
164 | 164 | uid_t uid, euid; |
165 | 165 | char *buffer, *tty_name, console_name[16], vcsa_name[16]; |
166 | | const char *p, *q; |
167 | 166 | struct winsize winsz; |
168 | 167 | |
169 | 168 | close (STDERR_FILENO); |
… |
… |
main (int argc, char **argv) |
198 | 197 | { |
199 | 198 | /* devfs */ |
200 | 199 | case 'v': |
201 | | p = "/dev/vc/%d"; |
202 | | q = "/dev/vcc/a%d"; |
| 200 | snprintf (console_name, sizeof (console_name), "/dev/vc/%d", console_minor); |
| 201 | snprintf (vcsa_name, sizeof (vcsa_name), "/dev/vcc/a%d", console_minor); |
203 | 202 | break; |
204 | 203 | /* /dev/ttyN */ |
205 | 204 | case 't': |
206 | | p = "/dev/tty%d"; |
207 | | q = "/dev/vcsa%d"; |
| 205 | snprintf (console_name, sizeof (console_name), "/dev/tty%d", console_minor); |
| 206 | snprintf (vcsa_name, sizeof (vcsa_name), "/dev/vcsa%d", console_minor); |
208 | 207 | break; |
209 | 208 | default: |
210 | 209 | die (); |
211 | 210 | } |
212 | 211 | |
213 | | snprintf (console_name, sizeof (console_name), p, console_minor); |
214 | 212 | if (strncmp (console_name, tty_name, sizeof (console_name)) != 0) |
215 | 213 | die (); |
216 | 214 | |
217 | 215 | if (seteuid (euid) < 0) |
218 | 216 | die (); |
219 | 217 | |
220 | | snprintf (vcsa_name, sizeof (vcsa_name), q, console_minor); |
221 | 218 | vcsa_fd = open (vcsa_name, O_RDWR); |
222 | 219 | if (vcsa_fd < 0) |
223 | 220 | die (); |