fix database handle

This commit is contained in:
Xuan Sang LE 2018-02-05 19:06:03 +01:00
parent 73adf50d41
commit fb43aac923
2 changed files with 3 additions and 2 deletions

View File

@ -62,7 +62,7 @@ void accept_request(int client)
} }
sprintf(path, server_config.htdocs); sprintf(path, server_config.htdocs);
strcat(path, url); strcat(path, url);
//printf("path is : %s \n", path); LOG("Path is : %s \n", path);
//if (path[strlen(path) - 1] == '/') //if (path[strlen(path) - 1] == '/')
// strcat(path, "index.html"); // strcat(path, "index.html");
if (stat(path, &st) == -1) { if (stat(path, &st) == -1) {

View File

@ -19,8 +19,9 @@ sqldb __getdb(char *name)
int plen = strlen(name)+strlen(__plugin__.dbpath)+4; int plen = strlen(name)+strlen(__plugin__.dbpath)+4;
char* path = (char*) malloc(plen*sizeof(char)); char* path = (char*) malloc(plen*sizeof(char));
strcpy(path,__plugin__.dbpath); strcpy(path,__plugin__.dbpath);
strcat(path,__plugin__.name); strcat(path,name);
strcat(path,".db"); strcat(path,".db");
LOG("data base: %s\n", path);
sqldb ret = (sqldb)database(path); sqldb ret = (sqldb)database(path);
free(path); free(path);
return ret; return ret;