#5 Add filename existence check

Unstable (example)
open
nobody
None
5
2013-05-22
2013-05-22
Kevin Ying
No

I'm frequently specifying the wrong filename as a typo or referencing the wrong path to the filename containing the password, so I wrote a small patch to add a check:

--- main.c.orig 2013-05-21 17:35:09.235437674 -0700
+++ main.c.filecheck 2013-05-21 17:34:45.395465799 -0700
@@ -430,6 +430,10 @@
write_pass_fd( srcfd, fd );
close( srcfd );
}
+ else {
+ fprintf(stderr, "sshpass: -f option given but file %s not found\n", args.pwsrc.filename);
+ exit(1);
+ }
}
break;
case PWT_PASS:

Discussion


Log in to post a comment.