vdc: fix segfault

Change-Id: I1a35fe15b311d3f5203c5bc02d3db87e942cf554
This commit is contained in:
Mohamad Ayyash 2014-04-15 18:08:05 -07:00
parent efec3f2927
commit 5e900ac898

10
vdc.c
View file

@ -39,18 +39,20 @@ static int do_cmd(int sock, int argc, char **argv);
int main(int argc, char **argv) {
int sock;
int wait_for_socket;
char *progname;
if (argc < 2)
usage(argv[0]);
progname = argv[0];
wait_for_socket = strcmp(argv[1], "--wait") == 0;
wait_for_socket = argc > 1 && strcmp(argv[1], "--wait") == 0;
if(wait_for_socket) {
argv++;
argc--;
}
if(argc < 2)
if(argc < 2) {
usage(progname);
exit(5);
}
while ((sock = socket_local_client("vold",
ANDROID_SOCKET_NAMESPACE_RESERVED,