client: Use fnameat() to construct history file name
We truncate the user's home directory name to 1000 characters when constructing the history file name. Use fnameat() to fix that. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
6b72fefafb
commit
a0220e864f
3 changed files with 11 additions and 12 deletions
|
@ -47,6 +47,7 @@
|
|||
#include <pwd.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include "fnameat.h"
|
||||
#include "misc.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -190,12 +191,8 @@ main(int argc, char **argv)
|
|||
|
||||
sock = tcp_connect(host, port);
|
||||
|
||||
if (use_history_file) {
|
||||
/* FIXME don't truncate udir */
|
||||
history_file = malloc(1024);
|
||||
strncpy(history_file, udir, 1000);
|
||||
strcat(history_file, "/.empire.history");
|
||||
}
|
||||
if (use_history_file)
|
||||
history_file = fnameat(".empire_history", udir);
|
||||
|
||||
if (!login(sock, uname, country, passwd, send_kill, utf8))
|
||||
exit(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue