From 55f09b61527e0cd868acdf3f32b077a882ab94b3 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Wed, 9 Dec 2020 08:31:09 +0100 Subject: Use get_expanded_path() in cmd_senfile() --- src/command/cmd_funcs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/command') diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index fd9d2ffd..68153270 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -4854,18 +4854,12 @@ gboolean cmd_sendfile(ProfWin* window, const char* const command, gchar** args) { jabber_conn_status_t conn_status = connection_get_status(); - char* filename = args[0]; + gchar* filename; char* alt_scheme = NULL; char* alt_fragment = NULL; // expand ~ to $HOME - if (filename[0] == '~' && filename[1] == '/') { - if (asprintf(&filename, "%s/%s", getenv("HOME"), filename + 2) == -1) { - return TRUE; - } - } else { - filename = strdup(filename); - } + filename = get_expanded_path(args[0]); if (access(filename, R_OK) != 0) { cons_show_error("Uploading '%s' failed: File not found!", filename); -- cgit 1.4.1-2-gfad0