lua: snprintf include trailing \0 in size

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-27 17:15:47 +02:00
parent dcbd7a7c14
commit 5bb2277ef2
1 changed files with 3 additions and 3 deletions

6
lua.c
View File

@ -660,7 +660,7 @@ luaA_parserc(const char *confpatharg)
confpath = p_new(char, len);
a_strcpy(confpath, len, confdir);
/* update package.path */
snprintf(path, sizeof(path) - 1, "package.path = package.path .. \";%s/awesome/?.lua\"", confdir);
snprintf(path, sizeof(path), "package.path = package.path .. \";%s/awesome/?.lua\"", confdir);
luaA_dostring(globalconf.L, path);
}
else
@ -671,7 +671,7 @@ luaA_parserc(const char *confpatharg)
a_strcpy(confpath, len, confdir);
a_strcat(confpath, len, XDG_CONFIG_HOME_DEFAULT);
/* update package.path */
snprintf(path, sizeof(path) - 1, "package.path = package.path .. \";%s" XDG_CONFIG_HOME_DEFAULT "/awesome/?.lua\"", confdir);
snprintf(path, sizeof(path), "package.path = package.path .. \";%s" XDG_CONFIG_HOME_DEFAULT "/awesome/?.lua\"", confdir);
luaA_dostring(globalconf.L, path);
}
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
@ -698,7 +698,7 @@ luaA_parserc(const char *confpatharg)
confpath = p_new(char, len);
a_strcpy(confpath, len, *buf);
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
snprintf(path, sizeof(path) - 1, "package.path = package.path .. \";%s/awesome/?.lua\"", *buf);
snprintf(path, sizeof(path), "package.path = package.path .. \";%s/awesome/?.lua\"", *buf);
luaA_dostring(globalconf.L, path);
if(luaL_dofile(globalconf.L, confpath))
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));