Skip to content

Commit 8f17f3c

Browse files
committed
Fix handling of options
add missign `break`. exit with different return code for different error. fixes commit e9dbbe0 (Add support for user specified id)
1 parent 64bf27e commit 8f17f3c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mqtt-exec.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ int main(int argc, char *argv[])
205205
break;
206206
case 'P':
207207
password = optarg;
208+
break;
208209
case 'q':
209210
ud.qos = atoi(optarg);
210211
if (!valid_qos_range(ud.qos, "QoS"))
@@ -218,6 +219,7 @@ int main(int argc, char *argv[])
218219
break;
219220
case 'u':
220221
username = optarg;
222+
break;
221223
case 'v':
222224
ud.verbose = 1;
223225
break;
@@ -267,7 +269,7 @@ int main(int argc, char *argv[])
267269
}
268270

269271
if ((ud.topics == NULL) || (optind == argc))
270-
return usage(1);
272+
return usage(2);
271273

272274
ud.command_argc = (argc - optind) + 1 + ud.verbose;
273275
ud.command_argv = malloc((ud.command_argc + 1) * sizeof(char *));

0 commit comments

Comments
 (0)