From 5efee183569ede0a4155f8195e1b1be58e954b95 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Mon, 19 Jun 2017 21:39:32 +0500 Subject: [PATCH] resolve couple of issues found by cppcheck: [psftp.c:1135] -> [psftp.c:1134]: (warning) Either the condition '!dir' is redundant or there is possible null pointer dereference: dir. [psftp.c:1420] -> [psftp.c:1419]: (warning) Either the condition '!dir' is redundant or there is possible null pointer dereference: dir. --- psftp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/psftp.c b/psftp.c index 5394c1fb..aa397181 100644 --- a/psftp.c +++ b/psftp.c @@ -1128,12 +1128,12 @@ int sftp_cmd_cd(struct sftp_command *cmd) if (cmd->nwords < 2) dir = dupstr(homedir); - else + else { dir = canonify(cmd->words[1]); - - if (!dir) { - printf("%s: canonify: %s\n", dir, fxp_error()); - return 0; + if (!dir) { + printf("%s: canonify: %s\n", cmd->words[1], fxp_error()); + return 0; + } } req = fxp_opendir_send(dir); @@ -1417,7 +1417,7 @@ int sftp_cmd_mkdir(struct sftp_command *cmd) for (i = 1; i < cmd->nwords; i++) { dir = canonify(cmd->words[i]); if (!dir) { - printf("%s: canonify: %s\n", dir, fxp_error()); + printf("%s: canonify: %s\n", cmd->words[i], fxp_error()); return 0; }