check whether a connection exists before executing certain commands

This commit is contained in:
josch
2014-10-25 11:34:34 +02:00
parent 5e24f47c10
commit fe17cb517f
11 changed files with 78 additions and 3 deletions

View File

@@ -29,6 +29,16 @@ int mfshell_cmd_whoami(mfshell * mfshell, int argc, char *const argv[])
(void)argv;
int retval;
if (mfshell == NULL) {
fprintf(stderr, "mfshell is NULL\n");
return -1;
}
if (mfshell->conn == NULL) {
fprintf(stderr, "conn is NULL\n");
return -1;
}
if (argc != 1) {
fprintf(stderr, "Invalid number of arguments\n");
return -1;