summaryrefslogtreecommitdiffstats
path: root/sample.c
diff options
context:
space:
mode:
Diffstat (limited to 'sample.c')
-rw-r--r--sample.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sample.c b/sample.c
index 543bcfc..debb09a 100644
--- a/sample.c
+++ b/sample.c
@@ -420,8 +420,14 @@ int main(int argc, char **argv){
}
opts(argc,argv);
signal(SIGTERM, do_exit);
- if(user)
- ssh_options_set_username(options,user);
+
+ if (user) {
+ if (ssh_options_set_username(options,user) < 0) {
+ ssh_options_free(options);
+ return 1;
+ }
+ }
+
if (ssh_options_set_host(options,host) < 0) {
ssh_options_free(options);
return 1;