if(read_line(fd, buffer, PROPERTY_KEY_MAX+PROPERTY_VALUE_MAX+1) < 0)
break;
tok = strtok(buffer, PROPERTY_SEPARATOR);
- for (i = 0; sdbd_config[i].key; i++) {
+ int array_element_cnt = sizeof(sdbd_config) / sizeof(sdbd_config[0]);
+ for (i = 0; i < array_element_cnt && sdbd_config[i].key ; i++) {
if (!strcmp(tok, sdbd_config[i].key)) {
tok = strtok(NULL, PROPERTY_SEPARATOR);
strncpy(sdbd_config[i].value, tok, PROPERTY_VALUE_MAX);
for (i=0; i<cnt; i++) {
D("tokenize: %dth: %s\n", i, tokens[i]);
- if (!strncmp(tokens[i], "export", sizeof("export"))) {
+ if (!strcmp("export", tokens[i])) {
flag = 0;
i++;
if (i>=cnt) break;
}
i++;
if (i>=cnt) break;
- if (!strncmp(tokens[i], "&&", sizeof("&&"))) {
+ if (!strcmp("&&", tokens[i])) {
continue;
}
}
// TODO: check evn setting
}
- if(!strncmp(tokens[i], SDK_LAUNCH_PATH, sizeof(SDK_LAUNCH_PATH))) {
+ if(!strcmp(tokens[i], SDK_LAUNCH_PATH)) {
int debug = 0;
int pid = 0;
char* pkg_id = NULL;
char* executable = NULL;
++i;
while( i < cnt ) {
- if(!strncmp(tokens[i], "-attach", sizeof("-attach"))) {
+ if(!strcmp(tokens[i], "-attach")) {
if(++i < cnt) {
char* pid_pattern = "[1-9][0-9]{2,5}";
if (regcmp(pid_pattern, tokens[i])) {
}
}
}
- else if(!strncmp(tokens[i], "-p", sizeof("-p"))) {
+ else if(!strcmp(tokens[i], "-p")) {
if(++i < cnt) {
pkg_id = tokens[i];
}
}
- else if(!strncmp(tokens[i], "-e", sizeof("-e"))) {
+ else if(!strcmp(tokens[i], "-e")) {
if(++i < cnt) {
executable = tokens[i];
}
ret = sdb_write(h->control, &descriptors, sizeof(descriptors));
if (ret < 0) {
D("[ %s: cannot write descriptors ]\n", h->EP0_NAME);
- h->control = -errno;
sdb_mutex_unlock(&h->control_lock);
goto error;
}
ret = sdb_write(h->control, &strings, sizeof(strings));
if(ret < 0) {
D("[ %s: cannot write strings ]\n", h->EP0_NAME);
- h->control = -errno;
sdb_mutex_unlock(&h->control_lock);
goto error;
}