summaryrefslogtreecommitdiff
path: root/scripts/kconfig/nconf.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2021-04-10 22:45:30 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2021-04-14 09:22:49 +0300
commit68876c38c4b30653c1779414954ce747a455253c (patch)
treea6b5b6cb1612a6aaee78fcf443d67f15b23d8991 /scripts/kconfig/nconf.c
parentf02aa48dde8b96eef5998b049ad11547bfc16080 (diff)
downloadlinux-68876c38c4b30653c1779414954ce747a455253c.tar.xz
kconfig: mconf,nconf: remove unneeded '\0' termination after snprintf()
snprintf() always terminates the destination buffer with '\0' even if the buffer is not long enough. (In this case, the last element of the buffer becomes '\0'.) The explicit termination is unneeded. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/nconf.c')
-rw-r--r--scripts/kconfig/nconf.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 0cce69ccb611..06ebe16e4a38 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -633,16 +633,10 @@ static char filename[PATH_MAX+1];
static char menu_backtitle[PATH_MAX+128];
static const char *set_config_filename(const char *config_filename)
{
- int size;
+ snprintf(menu_backtitle, sizeof(menu_backtitle), "%s - %s",
+ config_filename, rootmenu.prompt->text);
- size = snprintf(menu_backtitle, sizeof(menu_backtitle),
- "%s - %s", config_filename, rootmenu.prompt->text);
- if (size >= sizeof(menu_backtitle))
- menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
-
- size = snprintf(filename, sizeof(filename), "%s", config_filename);
- if (size >= sizeof(filename))
- filename[sizeof(filename)-1] = '\0';
+ snprintf(filename, sizeof(filename), "%s", config_filename);
return menu_backtitle;
}