Skip to content

Commit 2c4c65e

Browse files
committed
fixes
1 parent e1c5984 commit 2c4c65e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

poverlay.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ void psync_start_overlay_callbacks(){
139139

140140
void get_answer_to_request(message *request, message *replay)
141141
{
142-
char msg[4] = "Ok.";
143142
external_status stat = INVSYNC;
143+
memcpy(replay->value, "Ok.", 4);
144+
replay->length=sizeof(message)+4;
144145
//debug(D_NOTICE, "Client Request type [%u] len [%lu] string: [%s]", request->type, request->length, request->value);
145146
if (request->type < 20 ) {
146147

@@ -182,30 +183,26 @@ void get_answer_to_request(message *request, message *replay)
182183
break;
183184
default:
184185
replay->type=13;
185-
memcpy(msg, "No.", 4);
186+
memcpy(replay->value, "No.", 4);
186187
}
187188
} else if ((callbacks_running)&&(request->type < 36)) {
188189
int ind = request->type - 20;
189190
int ret = 0;
190191
if (callbacks[ind]) {
191192
if ((ret = callbacks[ind](request->value)) == 0) {
192193
replay->type = 0;
193-
replay->length = sizeof(message)+4;
194-
strncpy(replay->value, msg, 4);
195194
} else {
196195
replay->type = ret;
197-
strncpy(msg,"No.\0",4);
196+
memcpy(replay->value, "No.", 4);
198197
}
199-
strncpy(replay->value, msg, 4);
200-
replay->length = sizeof(message)+4;
201198
} else {
202199
replay->type = 13;
203-
strncpy(replay->value, "No callback with this id registered.\0", 37);
200+
memcpy(replay->value, "No callback with this id registered.", 37);
204201
replay->length = sizeof(message)+37;
205202
}
206203
} else {
207204
replay->type = 13;
208-
strncpy(replay->value, "Invalid type.\0", 14);
205+
memcpy(replay->value, "Invalid type.", 14);
209206
replay->length = sizeof(message)+14;
210207
}
211208

ppathstatus.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ static psync_path_status_t rdunlock_return_in_prog() {
374374
}
375375

376376
static psync_path_status_t psync_path_status_drive_folder_locked(psync_folderid_t folderid) {
377+
if (get_folder_tasks(folderid, 0))
378+
return rdunlock_return_in_prog();
377379
psync_sql_rdunlock();
378380
return PSYNC_PATH_STATUS_IN_SYNC;
379381
}
@@ -472,6 +474,7 @@ static psync_path_status_t psync_path_status_drive(const char *path, size_t path
472474
folderid=ce->itemid;
473475
flags=ce->flags;
474476
found=1;
477+
poff=off+1;
475478
break;
476479
}
477480
if (found)
@@ -504,6 +507,7 @@ static psync_path_status_t psync_path_status_drive(const char *path, size_t path
504507
memcpy(ce->hash, hash, sizeof(hash));
505508
ce->itemid=folderid;
506509
ce->flags=flags;
510+
poff=off+1;
507511
}
508512
}
509513
if (poff==path_len)
@@ -519,7 +523,7 @@ static psync_path_status_t psync_path_status_drive(const char *path, size_t path
519523
h=(hash[0]+hash[2])%PATH_HASH_SIZE;
520524
found=0;
521525
psync_list_for_each_element (ce, &path_cache_hash[h], path_cache_entry_t, list_hash)
522-
if (!memcmp(hash, ce->hash, sizeof(hash)) && (ce->flags&ENTRY_FLAG_FOLDER)) {
526+
if (!memcmp(hash, ce->hash, sizeof(hash))) {
523527
if (wrlocked) {
524528
psync_list_del(&ce->list_lru);
525529
psync_list_add_tail(&path_cache_lru, &ce->list_lru);

0 commit comments

Comments
 (0)