X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=cmds.c;h=a8453def6aacbc4f01c3076a0fae9611cb0382ea;hb=4ad0559c71f4ef2f498a8b236a53eda9bcdd5c2c;hp=64e4c1a9eb86670d94a9db9cf60b3d5c1ea36f55;hpb=a56ea10ad9fab6db773d05852e0f313d24ae89fd;p=betaftpd diff --git a/cmds.c b/cmds.c index 64e4c1a..a8453de 100644 --- a/cmds.c +++ b/cmds.c @@ -806,7 +806,7 @@ int cmd_rnfr(struct conn * const c) snprintf(c->rename_from, 256, "%s/%s", cwd, fname); /* Just check that the file exists. */ - TRAP_ERROR(lstat(c->rename_from, &buf) == -1, 550, return 1); + TRAP_ERROR(lstat(c->rename_from, &buf) == -1, 550, c->rename_from[0] = '\0'; return 1); numeric(c, 350, "File exists, send RNTO."); return 1; @@ -825,9 +825,10 @@ int cmd_rnto(struct conn * const c) return 1; } - TRAP_ERROR(rename(c->rename_from, fname) == -1, 550, return 1); + TRAP_ERROR(rename(c->rename_from, fname) == -1, 550, c->rename_from[0] = '\0'; return 1); + c->rename_from[0] = '\0'; - numeric(c, 250, "File renamed successfulyy."); + numeric(c, 250, "File renamed successfully."); return 1; } @@ -1745,9 +1746,9 @@ int do_openfile(struct conn * const c, char * const path, #if WANT_UPLOAD if ((flags & O_CREAT) == 0) { #endif - stat(ptr, &buf); + TRAP_ERROR(stat(ptr, &buf) == -1, 550, return -2); if (!S_ISREG(buf.st_mode)) { - numeric(c, 550, "%s: Not a plain file.", ptr); + numeric(c, 550, "Not a plain file.", ptr); return -2; } #if WANT_UPLOAD